May 13, 2010, 11:57 AM
[CLOSED] [1.0] Ext.Net.Field.SetValue compile error
Hello,</p>
I have downloaded the latest from SVN today and after compiling the app, I got the following errors in the application;
'Ext.Net.Field.SetValue(object)' is inaccessible due to its protection level
This worked fine prior this current SVN version.</p>
Code behind
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Text;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using DataAccessLayer;
using BusinessAccessLayer;
using CORE1.Data;
using Ext.Net;</p>
namespace WebClientTrackerII.App.Admin
{
public partial class EmployeeEdit : WebClientTrackerII.Classes.BaseWebControl
{
#region Properties
protected SqlDataSource dsource = new SqlDataSource();
//protected Store GridStore = new Store();</p>
public Store GridStore
{
get;
set;
}</p>
public GridPanel StaffGrid
{
get;
set;
}</p>
protected string PhoneJson
{
get;
set;
}</p>
protected string EmailJson
{
get;
set;
}</p>
private bool cancel;
private string message;
private string PhoneMessage;
private string EmailMessage;
private bool save = true;</p>
#endregion</p>
protected void Page_Load(object sender, EventArgs e)
{
if (!X.IsAjaxRequest)
{
//this.EmployeesStore.DataSourceID = dsource.ID;
//this.EmployeesStore.DataBind();</p>
}</p>
if (!IsPostBack)
{
}
}</p>
#region Methods
/// <summary>
///
/// </summary>
/// <param name="datainput"></param>
public void SetEmployee(string datainput)
{</p>
string fullName = string.Empty;</p>
Dictionary<string, string>[] grid1Data = JSON.Deserialize<Dictionary<string, string>[]>(datainput);</p>
foreach (IDictionary<string, string> properties in grid1Data)
{
this.USERID.SetValue(properties["USERID"]);
this.LASTNAME.SetValue(properties["LASTNAME"]);
this.PERSONID.SetValue(properties["PERSONID"]);
this.MIDDLENAME.SetValue(properties["MIDDLENAME"]);
this.FIRSTNAME.SetValue(properties["FIRSTNAME"]);
this.HIDDENPOSITIONID.SetValue(properties["POSITIONID"]);
this.POSITIONID.SetValue(properties["POSITIONID"]);
this.USERCURRENTLEVEL.SetValue(properties["USERCURRENTLEVELID"]);
this.USERPRIMARYLEVEL.SetValue(properties["USERPRIMARYLEVELID"]);
this.ACTIVE.Hidden = false;
this.ACTIVE.SetValue(properties["ACTIVE"]);
this.SYSGUID.SetValue(properties["SYSTEMUSERID"]);
this.REGIONALDIVISION.SetValue(properties["REGIONALDIVISION"]);
this.THEMATICDISION.SetValue(properties["THEMATICDISION"]);
this.SUFFIX.SetValue(properties["SUFFIX"]);
// this.EmployeeDetailswindow.Title = properties["LASTNAME"] +
if (!string.IsNullOrEmpty(properties["REVERTTODATE"]))
{
this.REVERTTODATE.SetValue(Convert.ToDateTime(properties["REVERTTODATE"]));
}
else
{
this.REVERTTODATE.SetValue(null);
}</p>
// Display dropdowns if values are not empty
if (!string.IsNullOrEmpty(properties["REGIONALDIVISION"]))
{
this.REGIONALDIVISION.Hidden = false;
}</p>
if (!string.IsNullOrEmpty(properties["THEMATICDISION"]))
{
this.THEMATICDISION.Hidden = false;
}</p>
this.PERSONID.Text = properties["PERSONID"].ToString();</p>
this.TabPanel1.SetActiveTab(0);</p>
// Load Phone Inforation
SqlDataSourcePhone.DataBind();
storeStaffPhone.DataBind();</p>
// Load Eamil Information
SqlDataSourceStaffEmail.DataBind();
storeStaffEmail.DataBind();</p>
</p>
if (properties["ACTIVE"] == "True")
{
this.ACTIVE.Checked = true;
this.ACTIVE.Enabled = true;
}</p>
</p>
fullName = properties["LASTNAME"] + ", " + properties["FIRSTNAME"] + " " + properties["MIDDLENAME"];
}
//this.USERID.Disabled = true;</p>
this.EmployeeDetailswindow.Title = "User Detail - " + fullName;
}</p>
// Show pop-up window
public void Show()
{
this.EmployeeDetailswindow.Show();
}</p>
// Hide pop-up window
public void Hide()
{
this.EmployeeDetailswindow.Hide();
}</p>
</p>
public void setDataSourceObject(SqlDataSource source)
{
dsource = source;
}</p>
public void ResetFilter()
{
Store store1 = new Store();
SqlDataSource sqldsource = new SqlDataSource();
PagingToolbar pgnToolbar = new PagingToolbar();
sqldsource = (SqlDataSource)this.Parent.FindControl("SqlDataSource1");
store1 = (Store)this.Parent.FindControl("Store1");
pgnToolbar = (PagingToolbar)this.Parent.FindControl("PagingToolBar4");
////this.dsource.FilterExpression = "USERCURRENTLEVEL <> '0'";
////this.dsource.DataBind();
//this.GridStore.DataBind();
//sqldsource.FilterExpression = "";
sqldsource.DataBind();
store1.DataBind();
pgnToolbar.SetPageSize(20);
</p>
}</p>
[DirectMethod]
public void ClearGrid(GridPanel grd)
{
grd.ColumnModel.Columns.Clear();
}</p>
/// <summary>
/// Insert or Update entered or modified user
/// entered data
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
public void SubmitData(object sender, DirectEventArgs e)
{</p>
//JSON representation
this.PhoneJson = e.ExtraParams["PhoneGrid"];
this.EmailJson = e.ExtraParams["EmailGrid"];</p>
string revertTodateIn = e.ExtraParams["revertDateValue"];
string newDatestr = revertTodateIn.Replace("\"", "");
StringBuilder ErrorMessage = new StringBuilder();
BusinessAccessLayer.StaffBO staff = new StaffBO();</p>
string userid = string.Empty;
string sysid = string.Empty;
string active = string.Empty;
string errorReturned = string.Empty;
string staffid = string.Empty;</p>
sysid = this.SYSGUID.Value.ToString();
userid = this.USERID.Value.ToString();
staffid = this.PERSONID.Value.ToString();</p>
staff.FirstName = this.FIRSTNAME.Text;
staff.LastName = this.LASTNAME.Text;
staff.MiddleName = this.MIDDLENAME.Text;
active = this.ACTIVE.Value.ToString();
staff.StaffPosition = this.POSITIONID.SelectedItem.Value.ToString();
staff.CurrentSecurityLevel = this.USERCURRENTLEVEL.SelectedItem.Value.ToString();
staff.PrimarySecurityLevel = this.USERPRIMARYLEVEL.SelectedItem.Value.ToString();
staff.RevertToDate = (Nullable<DateTime>)this.REVERTTODATE.Value;
staff.RegionalDivision = this.REGIONALDIVISION.SelectedItem.Value.ToString();
staff.ThematicDivision = this.THEMATICDISION.SelectedItem.Value.ToString();
staff.Suffix = this.SUFFIX.SelectedItem.Value.ToString();</p>
if (!staff.RevertToDate.HasValue)
{
staff.RevertToDate = Convert.ToDateTime(Convert.DBNull);
}</p>
// Check for missing values
if (string.IsNullOrEmpty(userid))
ErrorMessage.Append("* User ID <br>");
if (string.IsNullOrEmpty(staff.LastName))
ErrorMessage.Append("* Last Name <br>");
if (this.THEMATICDISION.Hidden == false)
{
if (string.IsNullOrEmpty(staff.ThematicDivision))
ErrorMessage.Append("* Thematic Division <br>");
}</p>
if (this.REGIONALDIVISION.Hidden == false)
{
if (string.IsNullOrEmpty(staff.RegionalDivision))
ErrorMessage.Append("* Region <br>");
}
if (string.IsNullOrEmpty(staff.FirstName))
ErrorMessage.Append("* First Name <br>");
if (string.IsNullOrEmpty(staff.StaffPosition))
ErrorMessage.Append("* Position <br>");
if (string.IsNullOrEmpty(staff.CurrentSecurityLevel))
ErrorMessage.Append("* User Current Level <br>");
if (string.IsNullOrEmpty(staff.PrimarySecurityLevel))
ErrorMessage.Append("* User Primary Level <br>");</p>
if (!string.IsNullOrEmpty(newDatestr))
{
if (Convert.ToDateTime(newDatestr) < DateTime.Today)
{
ErrorMessage.Append("* Revert date cannot be on the past <br>");
}
}
// Validate for required fields
if (!string.IsNullOrEmpty(ErrorMessage.ToString()))
{
this.ShowMessage("Missing Required Data", "The following required data is missing or invalid<br>" + ErrorMessage.ToString());
}
else
{
// Check for exisitng key
// if sysid is empty, Insert
if (sysid == string.Empty)
{
try
{
this.InsertUser(userid, staff, ref errorReturned);
if (!string.IsNullOrEmpty(errorReturned))
{
this.ShowMessage("User Exists", errorReturned);</p>
}
}
catch (Exception ex)
{
throw ex;
}
}
else
{
// If there is a key, Update
this.updateUser(sysid,staffid, userid, staff, active);</p>
}
}
}</p>
private bool ValiDateEmail(string email)
{
if (System.Text.RegularExpressions.Regex.IsMatch(email,
@"^([0-9a-zA-Z]([-\.\w]*[0-9a-zA-Z])*@([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,9})$"))
{
return true;
}</p>
return false;
}</p>
/// <summary>
/// Insert new user
/// </summary>
/// <param name="UserID"></param>
/// <param name="gender"></param>
/// <param name="firstname"></param>
/// <param name="middleName"></param>
/// <param name="lastName"></param>
/// <param name="role"></param>
/// <param name="error"></param>
private void InsertUser(string UserNetworkID, StaffBO staff, ref string error)
{
bool flag = false;</p>
SecurityDB scrty = new SecurityDB();
if (scrty.IsUserInSystem2(UserNetworkID.ToUpper()))
{
flag = true;
}</p>
if (flag)
{
error = "User already exist in Database!";
}
else
{
Users usrs = new Users();</p>
string outStaffId = string.Empty;</p>
usrs.Insert_NewUser(UserNetworkID, staff, Session["UserNetworkName"].ToString(), ref outStaffId);
this.PERSONID.Text = outStaffId;</p>
if ((!this.SavePhone(this.PhoneJson)) || !this.SaveEmail(this.EmailJson))
{
this.ShowMessage("Validation Error", this.message);
}
else
{
this.SaveGrid(gridPhone);
this.SaveGrid(gridEmail);</p>
//usrs.Dispose();
error = string.Empty;
this.ResetFilter();
this.EmployeeDetailswindow.Hide();
}</p>
}
}</p>
/// <summary>
/// Update existing user information
/// </summary>
/// <param name="userSysguid"></param>
/// <param name="personSysGuid"></param>
/// <param name="userId"></param>
/// <param name="gender"></param>
/// <param name="firstname"></param>
/// <param name="middleName"></param>
/// <param name="lastName"></param>
/// <param name="role"></param>
/// <param name="active"></param>
public void updateUser(string userSysguid, string staffid, string userId, StaffBO staff, string active)
{
Users usrs = new Users();</p>
try
{
usrs.updateUser(userSysguid, userId, staffid, staff, active, Session["UserNetworkName"].ToString().ToUpper());</p>
if ((!this.SavePhone(this.PhoneJson)) || !this.SaveEmail(this.EmailJson))
{
this.ShowMessage("Validation Error", this.message);
return;
}
else
{
this.SaveGrid(gridPhone);
this.SaveGrid(gridEmail);</p>
//usrs.Dispose();
this.ResetFilter();
this.EmployeeDetailswindow.Hide();
}</p>
//this.ResetFilter();
//this.EmployeeDetailswindow.Hide();
}
catch (Exception ex)
{
throw ex;
}</p>
}</p>
protected bool SavePhone(string JsonData)
{
Dictionary<string, string>[] PhoneData = JSON.Deserialize<Dictionary<string, string>[]>(JsonData);
this.message = string.Empty;
//int PrimaryCount = 0;
string phoneNumber = string.Empty;</p>
// Nothing to do
if (PhoneData.Length <= 0)
return true;</p>
string phonelocationTemp = string.Empty;</p>
foreach (IDictionary<string, string> properties in PhoneData)
{
string phonetype = properties["PHONE_PHONE_TYPE_ID"].ToString();
string phonelocation = properties["PHONE_LOCTN_TYPE_ID"].ToString();</p>
// Check for duplicate primary indicator
string phonePrimaryIND = properties["PHONE_PRMRY_IND"].ToString();</p>
//if (phonePrimaryIND == "True")
//{
// PrimaryCount++;
//}</p>
if (phonelocationTemp == phonelocation)
{
this.message += "<br>* Phone Location cannot be duplicated";
}</p>
phonelocationTemp = phonelocation;</p>
if (string.IsNullOrEmpty(phonetype))
{
this.message += "<br>* Phone type cannot be empty";
}</p>
if (string.IsNullOrEmpty(phonelocation))
{
this.message += "<br>* Phone Location cannot be empty";
}</p>
if (!string.IsNullOrEmpty(this.message))
{
return false;
}</p>
}</p>
//if (PrimaryCount > 1)
//{
// this.message += "<br>* There can only be one Primary Phone.";
// return false;
//}</p>
//if (PrimaryCount == 0)
//{
// this.message += "<br>* No Primary Phone selected";
// return false;
//}</p>
return true;
}</p>
/// <summary>
/// Save Email
/// </summary>
/// <param name="JsonData"></param>
/// <returns></returns>
protected bool SaveEmail(string JsonData)
{</p>
Dictionary<string, string>[] EmailData = JSON.Deserialize<Dictionary<string, string>[]>(JsonData);
this.message = string.Empty;
int PrimatyCount = 0;
// Nothing to do
if (EmailData.Length <= 0)
return true;</p>
foreach (IDictionary<string, string> properties in EmailData)
{
string emaillocation = properties["EMAIL_LOCTN_TYPE_ID"].ToString();</p>
string emailPrimaryIND = properties["EMAIL_PRMRY_IND"].ToString();</p>
string emailAdrress = properties["EMAIL_ADRS_TXT"].ToString();</p>
if (emailPrimaryIND == "True")
{
PrimatyCount++;
}</p>
if (!this.ValiDateEmail(emailAdrress))
{
this.message += "<br>* Email Format is not valid";
}</p>
if (string.IsNullOrEmpty(emaillocation))
{
this.message += "<br>* Email Location cannot be empty";
}</p>
if (!string.IsNullOrEmpty(this.message))
{
return false;
}
}</p>
if (PrimatyCount > 1)
{
this.message += "<br>* There can only be one Primary Email.";
return false;
}</p>
return true;
}</p>
[DirectMethod]
public void NewEmployee()
{
this.EmployeeDetailswindow.Title = "New Employee";
this.EmployeeDetailswindow.Show();
}
#endregion</p>
#region Events</p>
protected void Date_Changed(object sender, DirectEventArgs e)
{</p>
string dateIn = e.ExtraParams["date"];</p>
DateTime dt1 = new DateTime();</p>
dt1 = Convert.ToDateTime(dateIn);</p>
if (dt1.Date < DateTime.Today)
{
this.REVERTTODATE.Reset();
this.ShowMessage("Date Validation", "Date entered cannot be in the past");
}</p>
}
/// <summary>
/// Dispalys the Regional Division drop down accordingly
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void USERROLEID_Selected(object sender, DirectEventArgs e)
{
string UserPosition = e.ExtraParams["Position"];</p>
switch (UserPosition)
{
case "Regional Program Officer":
this.REGIONALDIVISION.Hidden = false;
this.THEMATICDISION.Hidden = true;
break;
case "Administrator":
this.REGIONALDIVISION.Hidden = true;
this.THEMATICDISION.Hidden = true;
break;
case "Division Chief":
this.REGIONALDIVISION.Hidden = true;
this.THEMATICDISION.Hidden = false;
break;
case "Program Officer":
this.REGIONALDIVISION.Hidden = true;
this.THEMATICDISION.Hidden = false;
break;
case "Program Coordinator":
this.REGIONALDIVISION.Hidden = true;
this.THEMATICDISION.Hidden = false;
break;
default:
this.REGIONALDIVISION.Hidden = true;
this.THEMATICDISION.Hidden = true;
break;
}
}</p>
/// <summary>
/// Sets the Current level by default from the Primary level
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void USERPRIMARYLEVEL_Selected(object sender, DirectEventArgs e)
{
string UserPosition = e.ExtraParams["Level"];</p>
this.USERCURRENTLEVEL.SetValue(UserPosition);
}</p>
/// <summary>
/// Before Staff Phone is Inserted
/// into the Database
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void storeStaffPhone_BeforeRecordInserted(object sender, BeforeRecordInsertedEventArgs e)
{
object activeValue = new BusinessAccessLayer.Lookup.LocationType().GetLocationTypeName(e.NewValues["PHONE_LOCTN_TYPE_ID"].ToString());</p>
if (activeValue.ToString() == "HOME")
{
e.NewValues["PHONE_PRMRY_IND"] = "Y";
}
else if (activeValue.ToString() == string.Empty || activeValue.ToString() != "HOME")
{
e.NewValues["PHONE_PRMRY_IND"] = "N";
}
}</p>
/// <summary>
/// Before Staff Phone Inserts into the Database
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void storeStaffPhone_BeforeRecordUpdated(object sender, BeforeRecordUpdatedEventArgs e)
{
object activeValue = new BusinessAccessLayer.Lookup.LocationType().GetLocationTypeName(e.NewValues["PHONE_LOCTN_TYPE_ID"].ToString());</p>
if (activeValue.ToString() == "HOME")
{
e.NewValues["PHONE_PRMRY_IND"] = "Y";
}
else if (activeValue.ToString() == string.Empty || activeValue.ToString() != "HOME")
{
e.NewValues["PHONE_PRMRY_IND"] = "N";
}</p>
}</p>
protected void storeStaffPhone_AfterDirectEvent(object sender, AfterDirectEventArgs e)
{
if (e.Response.Success)
{
// set to .Success to false if we want to return a failure
//e.Response.Success = !cancel;
//e.Response.Message = message;
}
}</p>
protected void storeStaffPhone_BeforeAjaxEvent(object sender, BeforeDirectEventArgs e)
{
}</p>
</p>
/// <summary>
/// Before Staff Email inserts into the Database
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
protected void storeStaffEmail_BeforeRecordInserted(object sender, BeforeRecordInsertedEventArgs e)
{
object activeValue = e.NewValues["EMAIL_PRMRY_IND"];</p>
if (activeValue.ToString() == "true")
{
e.NewValues["EMAIL_PRMRY_IND"] = "Y";
}
else if (activeValue.ToString() == string.Empty || activeValue.ToString() == "false")
{
e.NewValues["EMAIL_PRMRY_IND"] = "N";
}
}</p>
/// <summary>
/// Before Staff Email Updates to database
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
/// </p>
protected void storeStaffEmail_BeforeRecordUpdated(object sender, BeforeRecordUpdatedEventArgs e)
{
object activeValue = e.NewValues["EMAIL_PRMRY_IND"];</p>
if (activeValue.ToString() == "true")
{
e.NewValues["EMAIL_PRMRY_IND"] = "Y";
}
else if (activeValue.ToString() == string.Empty || activeValue.ToString() == "false")
{
e.NewValues["EMAIL_PRMRY_IND"] = "N";
}</p>
}</p>
#endregion
}
}
Thank you,</p>