private static List <ATTOrganization> getOrganizationApplicationList(DataTable tbl) { List <ATTOrganization> lst = new List <ATTOrganization>(); try { foreach (DataRow row in tbl.Rows) { ATTOrganization OrgObj = new ATTOrganization ( int.Parse(row["org_id"].ToString()), (string)row["org_name"].ToString(), (string)row["org_type"].ToString(), (string)row["org_sub_type"].ToString(), (row["parent_id"] == System.DBNull.Value) ? 0 : int.Parse(row["parent_id"].ToString()) ); OrgObj.LSTOrgApplications = new BLLOrganizationApplications().GetOrgApplications(int.Parse(row["org_id"].ToString())); lst.Add(OrgObj); } lst.Insert(0, new ATTOrganization(0, "--- Select One ---", "", "", 0)); return(lst); } catch (Exception ex) { throw ex; } }
public static List <ATTOrganization> GetAllOrganization(int?orgID, string orgType, string orgEquCode) { List <ATTOrganization> lstOrg = new List <ATTOrganization>(); try { foreach (DataRow row in DLLOrganization.GetAllOrganization(orgID, orgType, orgEquCode).Rows) { ATTOrganization obj = new ATTOrganization(); obj.OrgSubType = row["ORG_SUB_TYPE"].ToString(); obj.OrgID = int.Parse(row["org_id"].ToString()); // obj.ParentId = int.Parse(row["PARENT_ID"].ToString()); obj.OrgType = row["org_type"].ToString(); obj.OrgName = row["ORG_NAME"].ToString(); //obj.OrgAddress = row["ORG_ADDRESS"].ToString(); //obj.OrgStreetName = row["ORG_STREET_NAME"].ToString(); //obj.OrgVdcMuni = int.Parse(row["ORG_VDC_MUNI"].ToString()); //obj.OrgUrl = row["ORG_URL"].ToString(); //obj.OrgWardNo = int.Parse(row["ORG_WARD_NO"].ToString()); //obj.OrgDistrict = int.Parse(row["ORG_DIST"].ToString()); obj.OrgEquCodes = row["ORG_EQU_CODE"].ToString(); lstOrg.Add(obj); } return(lstOrg); } catch (Exception ex) { throw ex; } }
public static int SaveOrganization(ATTOrganization Obj) { try { return(PCS.COMMON.DLL.DLLOrganization.SaveOrganization(Obj)); } catch (Exception ex) { throw ex; } }
public static ObjectValidation Validate(ATTOrganization objOrg) { ObjectValidation OV = new ObjectValidation(); if (objOrg.OrgName == "") { OV.IsValid = false; OV.ErrorMessage = "Organization Name cannot be Blank."; return(OV); } if (objOrg.OrgType == "0") { OV.IsValid = false; OV.ErrorMessage = "Organization Type cannot be Blank."; return(OV); } if (objOrg.OrgSubType == "0") { OV.IsValid = false; OV.ErrorMessage = "Organization Sub Type cannot be Blank."; return(OV); } if (objOrg.OrgDistrict == 0) { OV.IsValid = false; OV.ErrorMessage = "Organization District cannot be Blank."; return(OV); } if (objOrg.OrgVdcMuni == 0) { OV.IsValid = false; OV.ErrorMessage = "Organization VDC cannot be Blank."; return(OV); } if (objOrg.OrgWardNo == 0) { OV.IsValid = false; OV.ErrorMessage = "Organization Ward cannot be Blank."; return(OV); } if (objOrg.OrgAddress == "") { OV.IsValid = false; OV.ErrorMessage = "Organization Address cannot be Blank."; return(OV); } return(OV); }
void LoadOrganization() { try { List <ATTOrganization> lst = BLLOrganization.GetOrganizationNameList(); ATTOrganization org = new ATTOrganization(-1, "--- कार्यालय छान्नुहोस् ---"); lst.Insert(0, org); this.ddlOrg_Rqd.DataSource = lst; this.ddlOrg_Rqd.DataTextField = "OrgName"; this.ddlOrg_Rqd.DataValueField = "OrgID"; this.ddlOrg_Rqd.DataBind(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }
private static List <ATTOrganization> GetOrganizationList(DataTable tbl, int OrgDV) { List <ATTOrganization> lst = new List <ATTOrganization>(); List <ATTEmail> lstOrgEMail = BLLEmail.GetEmail(null); List <ATTPhone> lstOrgPhone = BLLPhone.GetPhone(null); try { foreach (DataRow row in tbl.Rows) { ATTOrganization OrgObj = new ATTOrganization ( int.Parse(row["org_id"].ToString()), (string)row["org_name"], ((row["org_type"] == System.DBNull.Value) ? "" : (string)row["org_type"]), ((row["org_sub_type"] == System.DBNull.Value) ? "" : (string)row["org_sub_type"]), ((row["parent_id"] == System.DBNull.Value) ? 0 : int.Parse(row["parent_id"].ToString())), ((row["org_address"] == System.DBNull.Value) ? "" : (string)row["org_address"]), ((row["org_street_name"] == System.DBNull.Value) ? "" : (string)row["org_street_name"]), ((row["org_vdc_muni"] == System.DBNull.Value) ? 0 : int.Parse(row["org_vdc_muni"].ToString())), ((row["org_url"] == System.DBNull.Value) ? "" : (string)row["org_url"]), ((row["org_ward_no"] == System.DBNull.Value) ? 0 : int.Parse(row["org_ward_no"].ToString())), ((row["org_dist"] == System.DBNull.Value) ? 0 : int.Parse(row["org_dist"].ToString())), ((row["org_equ_code"] == System.DBNull.Value) ? 0 : int.Parse(row["org_equ_code"].ToString())), ((row["zone_id"] == System.DBNull.Value) ? 0 : int.Parse(row["zone_id"].ToString())) ); OrgObj.LstEmail = lstOrgEMail.FindAll(delegate(ATTEmail email) { return(email.OrgId == OrgObj.OrgID); }); OrgObj.LstPhone = lstOrgPhone.FindAll(delegate(ATTPhone phone) { return(phone.OrgId == OrgObj.OrgID); }); lst.Add(OrgObj); } if (OrgDV != 0) { lst.Insert(0, new ATTOrganization(0, "छान्नहोस")); } return(lst); } catch (Exception ex) { throw ex; } }
private static List <ATTOrganization> GetOrganizationList(DataTable tbl) { List <ATTOrganization> lst = new List <ATTOrganization>(); List <ATTEmail> lstOrgEMail = BLLEmail.GetEmail(null); List <ATTPhone> lstOrgPhone = BLLPhone.GetPhone(null); try { foreach (DataRow row in tbl.Rows) { ATTOrganization OrgObj = new ATTOrganization ( int.Parse(row["org_id"].ToString()), (string)row["org_name"], ((row["org_type"] == System.DBNull.Value) ? "" : (string)row["org_type"]), ((row["org_sub_type"] == System.DBNull.Value) ? "" : (string)row["org_sub_type"]), ((row["parent_id"] == System.DBNull.Value) ? 0 : int.Parse(row["parent_id"].ToString())), ((row["org_address"] == System.DBNull.Value) ? "" : (string)row["org_address"]), ((row["org_street_name"] == System.DBNull.Value) ? "" : (string)row["org_street_name"]), ((row["org_vdc_muni"] == System.DBNull.Value) ? 0 : int.Parse(row["org_vdc_muni"].ToString())), ((row["org_url"] == System.DBNull.Value) ? "" : (string)row["org_url"]), ((row["org_ward_no"] == System.DBNull.Value) ? 0 : int.Parse(row["org_ward_no"].ToString())), ((row["org_dist"] == System.DBNull.Value) ? 0 : int.Parse(row["org_dist"].ToString())), ((row["org_equ_code"] == System.DBNull.Value) ? 0 : int.Parse(row["org_equ_code"].ToString())), ((row["zone_id"] == System.DBNull.Value) ? 0 : int.Parse(row["zone_id"].ToString())) ); OrgObj.LstEmail = lstOrgEMail.FindAll(delegate(ATTEmail email) { return(email.OrgId == OrgObj.OrgID); }); OrgObj.LstPhone = lstOrgPhone.FindAll(delegate(ATTPhone phone) { return(phone.OrgId == OrgObj.OrgID); }); // In GetOrganizationList(DataTable tbl) below code is added by shanjeev Sah OrgObj.NepDistname = row["DIST_UCODE"].ToString(); OrgObj.NepVdcname = row["VDC_UCODE"].ToString(); //OrgObj.ZoneName = row["zone_name"].ToString(); lst.Add(OrgObj); } return(lst); } catch (Exception ex) { throw ex; } }
public static List <ATTOrganization> GetOrgWithChilds(int orgID) { List <ATTOrganization> lst = new List <ATTOrganization>(); try { foreach (DataRow row in DLLOrganization.GetOrgWithChilds(orgID).Rows) { ATTOrganization OrgObj = new ATTOrganization(); OrgObj.OrgID = int.Parse(row["ORG_ID"].ToString()); OrgObj.OrgName = (string)row["ORG_NAME"]; OrgObj.OrgEquCode = ((row["ORG_EQU_CODE"] == System.DBNull.Value) ? 0 : int.Parse(row["ORG_EQU_CODE"].ToString())); OrgObj.LSTOrgUnit = BLLOrganizationUnit.GetOrganizationUnits(OrgObj.OrgID, null); lst.Add(OrgObj); } return(lst); } catch (Exception ex) { throw ex; } }
public static List <ATTOrganization> GetOrganizationNameList(string searchValue) { List <ATTOrganization> lstOrgName = new List <ATTOrganization>(); try { foreach (DataRow row in DLLOrganization.GetOrganization(searchValue).Rows) { ATTOrganization OrgObj = new ATTOrganization ( int.Parse(row["org_id"].ToString()), row["org_name"].ToString() ); lstOrgName.Add(OrgObj); } return(lstOrgName); } catch (Exception ex) { throw ex; } }
private void LoadOrganisations() { List <ATTOrganization> lst = BLLOrganization.GetOrganization(); ATTOrganization obj = new ATTOrganization(); obj.OrgName = " छान्नुहोस् "; obj.OrgID = -2; lst.Insert(0, obj); int i = lst.FindIndex( delegate(ATTOrganization ob) { return(ob.OrgID == orgID); } ); if (i >= 0) { lst.RemoveAt(i); } ddlOrg.DataSource = lst; ddlOrg.DataBind(); }
protected void lstUsers_SelectedIndexChanged(object sender, EventArgs e) { try { lstApplications.SelectedIndex = -1; if (this.DDLTransferTo.Items.Count <= 0) { List <ATTOrganization> lstAllOrg = BLLOrganization.GetOrganization(); ATTOrganization orgToRemove = lstAllOrg.Find ( delegate(ATTOrganization objOrg) { return(objOrg.OrgID == int.Parse(this.DDLOgranization.SelectedValue)); } ); lstAllOrg.Remove(orgToRemove); lstAllOrg.Insert(0, new ATTOrganization(0, "--- Select Organization ---", "", "", 0)); this.DDLTransferTo.DataSource = lstAllOrg; this.DDLTransferTo.DataTextField = "OrgName"; this.DDLTransferTo.DataValueField = "OrgID"; this.DDLTransferTo.DataBind(); } List <ATTOrganization> lstOrganization = (List <ATTOrganization>)Session["Organization"]; List <ATTUserRoles> lstUserRoles = lstOrganization[DDLOgranization.SelectedIndex].LSTOrgUsers[lstUsers.SelectedIndex].LSTUserRoles; lstUserRoles.Sort(delegate(ATTUserRoles a1, ATTUserRoles a2) { return(a1.ApplID.CompareTo(a2.ApplID)); }); grdRoles.DataSource = lstUserRoles; grdRoles.DataBind(); ATTUsers objUsers = lstOrganization[DDLOgranization.SelectedIndex].LSTOrgUsers[lstUsers.SelectedIndex].ObjUsers; this.txtPersonID.Text = (objUsers.PID == 0)?"":objUsers.PID.ToString(); this.txtUserName_RQD.Text = objUsers.Username; this.txtPassword_RQD.Attributes.Add("value", objUsers.Password); this.txtRePassword_RQD.Attributes.Add("value", objUsers.Password); //txtValidUpto_RDT.Text = objUsers.ValidUpto.ToShortDateString(); string dt = this.FormateDate(objUsers.ValidUpto); txtValidUpto_REDT.Text = dt; if (objUsers.Active == "Y") { this.chkActive.Checked = true; } else { this.chkActive.Checked = false; } this.txtUserName_RQD.Enabled = false; this.lblTransferTo.Visible = true; this.DDLTransferTo.Visible = true; this.chklstRoles.DataSource = ""; this.chklstRoles.DataBind(); // txtPassword_RQD.ReadOnly = true; //txtRePassword_RQD.Enabled = false; } catch (Exception ex) { throw ex; } }
protected void btnSave_Click(object sender, EventArgs e) { try { lblStatusMessage.Text = ""; List <ATTOrganization> lstOrg = (List <ATTOrganization>)Session["OrgList"]; int orgID = 0; if (this.lstOrgList.SelectedIndex > -1) { orgID = lstOrg[this.lstOrgList.SelectedIndex].OrgID; } ATTOrganization objOrg = new ATTOrganization( orgID, this.txtOrgName_Rqd.Text.Trim(), this.ddlOrgType_Rqd.SelectedValue, this.ddlOrgSubType_Rqd.SelectedValue, (ddlOrgParent.SelectedValue.ToString() == "") ? 0 : int.Parse(this.ddlOrgParent.SelectedValue.ToString()) ); foreach (ListItem lst in lstOrgList.Items) { if (lst.Text.ToLower() == txtOrgName_Rqd.Text.Trim().ToLower() && orgID == 0) { this.lblStatusMessage.Text = "Organization Name Already Exists"; this.programmaticModalPopup.Show(); return; } } objOrg.OrgAddress = txtAddress_Rqd.Text.Trim(); objOrg.OrgDistrict = (ddlOrgDistrict_Rqd.SelectedValue.ToString() == "") ? 0 : int.Parse(ddlOrgDistrict_Rqd.SelectedValue.ToString()); objOrg.OrgStreetName = txtStreet.Text.Trim(); objOrg.OrgVdcMuni = (ddlVdcMun_Rqd.SelectedValue.ToString() == "") ? 0 : int.Parse(ddlVdcMun_Rqd.SelectedValue.ToString()); objOrg.OrgWardNo = (ddlWard_Rqd.SelectedValue.ToString() == "") ? 0 : int.Parse(ddlWard_Rqd.SelectedValue.ToString()); objOrg.OrgUrl = txtUrl.Text.Trim(); foreach (ATTOrganization Att in lstOrg) { if (txtCourtCode_Rqd.Text.Trim().ToLower() == Att.OrgEquCode.ToString().ToLower() && orgID == 0) { this.lblStatusMessage.Text = "Organization Code Already Exists"; this.programmaticModalPopup.Show(); return; } } if (this.ddlOrgType_Rqd.SelectedValue == "CRT" && int.Parse(txtCourtCode_Rqd.Text.ToString()) == 0 && orgID > 0) { this.lblStatusMessage.Text = "Organization Code Should Not be Zero!!"; this.programmaticModalPopup.Show(); return; } if (this.ddlOrgType_Rqd.SelectedValue == "CRT") { objOrg.OrgEquCode = (txtCourtCode_Rqd.Text.ToString() == "") ? 0 : int.Parse(txtCourtCode_Rqd.Text.ToString()); } else { objOrg.OrgEquCode = 0; } objOrg.LstPhone = (List <ATTPhone>)Session["LstPhone"]; //objOrg.LstFax = (List<ATTFax>)Session["LstFax"]; objOrg.LstEmail = (List <ATTEmail>)Session["LstEmail"]; ObjectValidation OV = BLLOrganization.Validate(objOrg); if (OV.IsValid == false) { lblStatusMessage.Text = OV.ErrorMessage; this.programmaticModalPopup.Show(); return; } int newOrgID = 0; newOrgID = BLLOrganization.SaveOrganization(objOrg); if (newOrgID != 0) { this.lblStatusMessage.Text = "Organization Information Saved Successfully"; this.programmaticModalPopup.Show(); } if (this.lstOrgList.SelectedIndex > -1) { lstOrg[this.lstOrgList.SelectedIndex].OrgID = newOrgID; lstOrg[this.lstOrgList.SelectedIndex].OrgName = this.txtOrgName_Rqd.Text.Trim(); lstOrg[this.lstOrgList.SelectedIndex].OrgType = this.ddlOrgType_Rqd.SelectedValue; lstOrg[this.lstOrgList.SelectedIndex].OrgSubType = this.ddlOrgSubType_Rqd.SelectedValue; lstOrg[this.lstOrgList.SelectedIndex].ParentId = int.Parse(this.ddlOrgParent.SelectedValue.ToString()); lstOrg[this.lstOrgList.SelectedIndex].OrgAddress = txtAddress_Rqd.Text.Trim(); lstOrg[this.lstOrgList.SelectedIndex].OrgDistrict = int.Parse(ddlOrgDistrict_Rqd.SelectedValue.ToString()); lstOrg[this.lstOrgList.SelectedIndex].OrgStreetName = txtStreet.Text.Trim(); lstOrg[this.lstOrgList.SelectedIndex].OrgVdcMuni = int.Parse(ddlVdcMun_Rqd.SelectedValue.ToString()); lstOrg[this.lstOrgList.SelectedIndex].OrgWardNo = int.Parse(ddlWard_Rqd.SelectedValue.ToString()); lstOrg[this.lstOrgList.SelectedIndex].OrgUrl = txtUrl.Text.Trim(); lstOrg[this.lstOrgList.SelectedIndex].OrgEquCode = int.Parse(txtCourtCode_Rqd.Text.ToString()); lstOrg[this.lstOrgList.SelectedIndex].LstPhone.Clear(); lstOrg[this.lstOrgList.SelectedIndex].LstEmail.Clear(); foreach (GridViewRow row in this.grdEmail.Rows) { ATTEmail orgEMail = new ATTEmail(row.Cells[0].Text, row.Cells[1].Text, row.Cells[2].Text, row.Cells[3].Text); lstOrg[this.lstOrgList.SelectedIndex].LstEmail.Add(orgEMail); } foreach (GridViewRow row in this.grdPhone.Rows) { ATTPhone orgPhone = new ATTPhone(row.Cells[0].Text, row.Cells[1].Text, row.Cells[2].Text, row.Cells[3].Text); lstOrg[this.lstOrgList.SelectedIndex].LstPhone.Add(orgPhone); } } else { objOrg.OrgID = newOrgID; lstOrg.Add(objOrg); } Session["OrgList"] = lstOrg; this.lstOrgList.DataSource = lstOrg; this.lstOrgList.DataTextField = "OrgName"; this.lstOrgList.DataValueField = "OrgId"; this.lstOrgList.DataBind(); ClearControls(); } catch (Exception ex) { this.lblStatusMessage.Text = ex.Message; this.programmaticModalPopup.Show(); } }
public static int SaveOrganization(ATTOrganization ObjATT) { PCS.COREDL.GetConnection Conn = new GetConnection(); OracleConnection DBConn; OracleTransaction Tran; try { DBConn = Conn.GetDbConn(); Tran = DBConn.BeginTransaction(); string InsertUpdateSQL = ""; if (ObjATT.OrgID <= 0) InsertUpdateSQL = "SP_ADD_ORGNIZATIONS"; else InsertUpdateSQL = "SP_EDIT_ORGNIZATIONS"; OracleParameter[] ParamArray = new OracleParameter[12]; ParamArray[0] = PCS.FRAMEWORK.Utilities.GetOraParam(":p_ORG_ID", ObjATT.OrgID, OracleDbType.Int64, ParameterDirection.InputOutput); ParamArray[1] = PCS.FRAMEWORK.Utilities.GetOraParam(":p_ORG_NAME", ObjATT.OrgName, OracleDbType.Varchar2, ParameterDirection.Input); ParamArray[2] = PCS.FRAMEWORK.Utilities.GetOraParam(":p_ORG_TYPE", ObjATT.OrgType, OracleDbType.Varchar2, ParameterDirection.Input); ParamArray[3] = PCS.FRAMEWORK.Utilities.GetOraParam(":p_ORG_SUB_TYPE", ObjATT.OrgSubType, OracleDbType.Varchar2, ParameterDirection.Input); if (ObjATT.ParentId == 0) { ParamArray[4] = PCS.FRAMEWORK.Utilities.GetOraParam(":p_PARENT_ID", null, OracleDbType.Int64, ParameterDirection.Input); } else { ParamArray[4] = PCS.FRAMEWORK.Utilities.GetOraParam(":p_PARENT_ID", ObjATT.ParentId, OracleDbType.Int64, ParameterDirection.Input); } ParamArray[5] = PCS.FRAMEWORK.Utilities.GetOraParam(":p_ORG_ADDRESS", ObjATT.OrgAddress, OracleDbType.Varchar2, ParameterDirection.Input); ParamArray[6] = PCS.FRAMEWORK.Utilities.GetOraParam(":p_ORG_STREET_NAME", ObjATT.OrgStreetName, OracleDbType.Varchar2, ParameterDirection.Input); ParamArray[7] = PCS.FRAMEWORK.Utilities.GetOraParam(":p_ORG_VDC_MUNI", ObjATT.OrgVdcMuni, OracleDbType.Int64, ParameterDirection.Input); ParamArray[8] = PCS.FRAMEWORK.Utilities.GetOraParam(":p_ORG_URL", ObjATT.OrgUrl, OracleDbType.Varchar2, ParameterDirection.Input); ParamArray[9] = PCS.FRAMEWORK.Utilities.GetOraParam(":p_ORG_WARD_NO", ObjATT.OrgWardNo, OracleDbType.Int64, ParameterDirection.Input); ParamArray[10] = PCS.FRAMEWORK.Utilities.GetOraParam(":p_ORG_DIST", ObjATT.OrgDistrict, OracleDbType.Int64, ParameterDirection.Input); if(ObjATT.OrgEquCode==0) ParamArray[11] = PCS.FRAMEWORK.Utilities.GetOraParam(":p_ORG_EQU_CODE", null, OracleDbType.Int64, ParameterDirection.Input); else ParamArray[11] = PCS.FRAMEWORK.Utilities.GetOraParam(":p_ORG_EQU_CODE", ObjATT.OrgEquCode, OracleDbType.Int64, ParameterDirection.Input); SqlHelper.ExecuteNonQuery(Tran, CommandType.StoredProcedure, InsertUpdateSQL, ParamArray); int OrgID = int.Parse(ParamArray[0].Value.ToString()); DLLPhone.SaveOrganizationPhone(ObjATT.LstPhone, Tran, OrgID); DLLEmail.SaveOrganizationEmail(ObjATT.LstEmail, Tran, OrgID); Tran.Commit(); return OrgID; } catch (Exception ex) { throw ex; } finally { Conn.CloseDbConn(); } }