private void Init_Form() { AuthenticationManager Authentication = new AuthenticationManager(); IFacilitySetup FacilityMaster = (IFacilitySetup)ObjectFactory.CreateInstance("BusinessProcess.Administration.BFacility, BusinessProcess.Administration"); theFacilityDS = FacilityMaster.GetFacilityList(Convert.ToInt32(Session["SystemId"]), ApplicationAccess.FacilitySetup, 0); ViewState["FacilityDS"] = theFacilityDS; ViewState["grdDataSource"] = theFacilityDS.Tables[0]; ViewState["SortDirection"] = "Asc"; BindGrid(theFacilityDS.Tables[0]); }
private void Fill_Details() { string script; /*-------------------Dynamic Label Settings----------------------*/ //DataTable theDT = ((DataSet)ViewState["FacilityDS"]).Tables[1]; theFacilityDS = new DataSet(); AuthenticationManager Authentication = new AuthenticationManager(); IFacilitySetup FacilityMaster = (IFacilitySetup)ObjectFactory.CreateInstance("BusinessProcess.Administration.BFacility, BusinessProcess.Administration"); theFacilityDS = FacilityMaster.GetFacilityList(Convert.ToInt32(Session["SystemId"]), ApplicationAccess.FacilitySetup, 0); DataTable theDT = theFacilityDS.Tables[1]; lblCountry.InnerText = theDT.Rows[0]["Label"].ToString() + ":"; lblPOS.InnerText = theDT.Rows[1]["Label"].ToString() + ":"; lblSatellite.InnerText = theDT.Rows[2]["Label"].ToString() + ":"; /*---------------------------------------------------------------*/ if (Convert.ToInt32(ViewState["FacilityId"]) > 0) { DataView theDV = new DataView(((DataSet)ViewState["FacilityDS"]).Tables[0]); theDV.RowFilter = "FacilityId=" + ViewState["FacilityId"].ToString(); txtfacilityname.Text = theDV[0]["FacilityName"].ToString(); txtcountryno.Text = theDV[0]["CountryId"].ToString(); txtLPTF.Text = theDV[0]["PosId"].ToString(); txtSatelliteID.Text = theDV[0]["SatelliteId"].ToString(); txtNationalId.Text = theDV[0]["NationalId"].ToString(); txtGrace.Text = theDV[0]["AppGracePeriod"].ToString(); ddlprovince.SelectedValue = theDV[0]["provinceId"].ToString(); ddldistrict.SelectedValue = theDV[0]["DistrictId"].ToString(); if (theDV[0]["PepFarStartDate"].ToString() != "") { txtPEPFAR_Fund.Text = ((DateTime)theDV[0]["PepFarStartDate"]).ToString(Session["AppDateFormat"].ToString()); } cmbCurrency.SelectedValue = theDV[0]["Currency"].ToString(); if (theDV[0]["Status"].ToString() == "Active") { ddStatus.SelectedValue = "0"; } else if (theDV[0]["Status"].ToString() == "In-Active") { ddStatus.SelectedValue = "1"; } if (theDV[0]["Preferred"].ToString() == "Yes") { chkPreferred.Checked = true; } else { chkPreferred.Checked = false; } if (theDV[0]["Paperless"].ToString() == "Yes") { chkPaperlessclinic.Checked = true; ViewState["Paperless"] = "1"; } else { chkPaperlessclinic.Checked = false; ViewState["Paperless"] = "0"; } if (theDV[0]["StrongPassFlag"].ToString() == "1") { chkStrongPwd.Checked = true; } else { chkStrongPwd.Checked = false; } if (theDV[0]["ExpPwdFlag"].ToString() == "1") { chkexpPwd.Checked = true; script = ""; script = "<script language = 'javascript' defer ='defer' id = 'ExpNoofDays_0'>\n"; script += "show('divnoofdays');\n"; script += "</script>\n"; ClientScript.RegisterStartupScript(this.GetType(), "ExpNoofDays_0", script); txtnoofdays.Text = theDV[0]["ExpPwdDays"].ToString(); } else { chkexpPwd.Checked = false; script = ""; script = "<script language = 'javascript' defer ='defer' id = 'ExpNoofDays_1'>\n"; script += "hide('divnoofdays');\n"; script += "</script>\n"; ClientScript.RegisterStartupScript(this.GetType(), "ExpNoofDays_1", script); txtnoofdays.Text = ""; } //deepika txtcountryno.Enabled = true; txtLPTF.Enabled = true; txtSatelliteID.Enabled = true; //Facility Address txtFacAddress.Text = theDV[0]["FacilityAddress"].ToString(); txtFacCell.Text = theDV[0]["FacilityCell"].ToString(); txtFacEmail.Text = theDV[0]["FacilityEmail"].ToString(); txtFacFax.Text = theDV[0]["FacilityFax"].ToString(); txtFactele.Text = theDV[0]["FacilityTel"].ToString(); txtFacURL.Text = theDV[0]["FacilityURL"].ToString(); txtpharmfoottext.Text = theDV[0]["FacilityFooter"].ToString(); if (theDV[0]["FacilityTemplate"].ToString() == "0") { Radio1.Checked = true; } else if (theDV[0]["FacilityTemplate"].ToString() == "1") { Radio2.Checked = true; } //PMTCT Binding string strExpr; DataRow[] foundRows; DataView theDVmdl = new DataView(((DataSet)ViewState["FacilityDS"]).Tables[2]); strExpr = "FacilityId=" + ViewState["FacilityId"].ToString(); foundRows = theDVmdl.Table.Select(strExpr); if (foundRows.GetUpperBound(0) != -1) { foreach (DataRow dr in foundRows) { for (int i = 0; i < cblPMTCT.Items.Count; i++) { if (cblPMTCT.Items[i].Value == dr[1].ToString()) { cblPMTCT.Items[i].Selected = true; } } } } } }
//private void BindCombo() //{ // IQCareUtils theUtil = new IQCareUtils(); // DataTable theDT = theUtil.CreateTimeTable(15); // DataRow theDR = theDT.NewRow(); // theDR[0] = "0"; // theDR[1] = "Select"; // theDT.Rows.InsertAt(theDR, 0); // ddBackupTime.DataSource = theDT; // ddBackupTime.DataTextField = "Time"; // ddBackupTime.DataValueField = "Id"; // ddBackupTime.DataBind(); //} private void Fill_Details() { string script; /*-------------------Dynamic Label Settings----------------------*/ //DataTable theDT = ((DataSet)ViewState["FacilityDS"]).Tables[1]; theFacilityDS = new DataSet(); AuthenticationManager Authentication = new AuthenticationManager(); IFacilitySetup FacilityMaster = (IFacilitySetup)ObjectFactory.CreateInstance("BusinessProcess.Administration.BFacility, BusinessProcess.Administration"); theFacilityDS = FacilityMaster.GetFacilityList(Convert.ToInt32(Session["SystemId"]), ApplicationAccess.FacilitySetup, 0); DataTable theDT = theFacilityDS.Tables[1]; //lblCountry.InnerText = theDT.Rows[0]["Label"].ToString() + ":"; lblPOS.InnerText = theDT.Rows[1]["Label"].ToString() + ":"; lblSatellite.InnerText = theDT.Rows[2]["Label"].ToString() + ":"; /*---------------------------------------------------------------*/ if (Convert.ToInt32(ViewState["FacilityId"]) > 0) { DataView theDV = new DataView(((DataSet)ViewState["FacilityDS"]).Tables[0]); theDV.RowFilter = "FacilityId=" + ViewState["FacilityId"].ToString(); txtfacilityname.Text = theDV[0]["FacilityName"].ToString(); txtLPTF.Text = theDV[0]["PosId"].ToString(); txtSatelliteID.Text = theDV[0]["SatelliteId"].ToString(); txtNationalId.Text = theDV[0]["NationalId"].ToString(); txtGrace.Text = theDV[0]["AppGracePeriod"].ToString(); ddCountry.SelectedValue = theDV[0]["CountryId"].ToString(); //txtcountryno.Text = theDV[0]["CountryId"].ToString(); ddlprovince.SelectedValue = theDV[0]["provinceId"].ToString(); ddldistrict.SelectedValue = theDV[0]["DistrictId"].ToString(); if (theDV[0]["PepFarStartDate"].ToString() != "") { txtPEPFAR_Fund.Value = ((DateTime)theDV[0]["PepFarStartDate"]).ToString(Session["AppDateFormat"].ToString()); } cmbCurrency.SelectedValue = theDV[0]["Currency"].ToString(); if (theDV[0]["Status"].ToString() == "Active") { ddStatus.SelectedValue = "0"; } else if (theDV[0]["Status"].ToString() == "In-Active") { ddStatus.SelectedValue = "1"; } if (theDV[0]["Preferred"].ToString() == "Yes") { chkPreferred.Checked = true; } else { chkPreferred.Checked = false; } if (theDV[0]["Paperless"].ToString() == "Yes") { chkPaperlessclinic.Checked = true; ViewState["Paperless"] = "1"; } else { chkPaperlessclinic.Checked = false; ViewState["Paperless"] = "0"; } if (theDV[0]["StrongPassFlag"].ToString() == "1") { chkStrongPwd.Checked = true; } else { chkStrongPwd.Checked = false; } if (theDV[0]["ExpPwdFlag"].ToString() == "1") { chkexpPwd.Checked = true; script = ""; script = "<script language = 'javascript' defer ='defer' id = 'ExpNoofDays_0'>\n"; script += "show('divnoofdays');\n"; script += "</script>\n"; RegisterStartupScript("ExpNoofDays_0", script); txtnoofdays.Text = theDV[0]["ExpPwdDays"].ToString(); } else { chkexpPwd.Checked = false; script = ""; script = "<script language = 'javascript' defer ='defer' id = 'ExpNoofDays_1'>\n"; script += "hide('divnoofdays');\n"; script += "</script>\n"; RegisterStartupScript("ExpNoofDays_1", script); txtnoofdays.Text = ""; } //deepika ddCountry.Enabled = true; //txtcountryno.Enabled = true; txtLPTF.Enabled = true; txtSatelliteID.Enabled = true; //Facility Address txtFacAddress.Text = theDV[0]["FacilityAddress"].ToString(); txtFacCell.Text = theDV[0]["FacilityCell"].ToString(); txtFacEmail.Text = theDV[0]["FacilityEmail"].ToString(); txtFacFax.Text = theDV[0]["FacilityFax"].ToString(); txtFactele.Text = theDV[0]["FacilityTel"].ToString(); txtFacURL.Text = theDV[0]["FacilityURL"].ToString(); txtpharmfoottext.Text = theDV[0]["FacilityFooter"].ToString(); if (theDV[0]["FacilityTemplate"].ToString() == "0") { Radio1.Checked = true; } else if (theDV[0]["FacilityTemplate"].ToString() == "1") { Radio2.Checked = true; } if (theDV[0]["DateConstraint"].ToString() == "1") { chkdateconstraint.Checked = true; } else { chkdateconstraint.Checked = false; } //Billing if (theDV[0]["Billing"].ToString() == "1") { chkbilling.Checked = true; } else { chkbilling.Checked = false; } //PMSCM if (theDV[0]["PMSCM"].ToString() == "1") { chkpmscm.Checked = true; } else { chkpmscm.Checked = false; } //Wards chkwards.Checked = (theDV[0]["Wards"].ToString() == "1"); chkLMIS.Checked = (theDV[0]["LMIS"].ToString() == "1"); //PMTCT Binding string strExpr; DataRow[] foundRows; DataView theDVmdl = new DataView(((DataSet)ViewState["FacilityDS"]).Tables[2]); DataView dvStore = new DataView(((DataSet)ViewState["FacilityDS"]).Tables[3]); strExpr = "FacilityId=" + ViewState["FacilityId"].ToString(); foundRows = theDVmdl.Table.Select(strExpr); if (foundRows.GetUpperBound(0) != -1) { foreach (DataRow dr in foundRows) { for (int i = 0; i < cblPMTCT.Items.Count; i++) { if (cblPMTCT.Items[i].Value == dr[1].ToString()) { cblPMTCT.Items[i].Selected = true; } } } } // Already link stores with this facility foundRows = null; foundRows = dvStore.Table.Select(strExpr); if (foundRows.GetUpperBound(0) != -1) { foreach (DataRow dr in foundRows) { for (int i = 0; i < CBL_DrugStore.Items.Count; i++) { if (CBL_DrugStore.Items[i].Value == dr["StoreID"].ToString()) { CBL_DrugStore.Items[i].Selected = true; } } } } } //IFacilitySetup FacilityManager; //FacilityManager = (IFacilitySetup)ObjectFactory.CreateInstance("BusinessProcess.Administration.BFacility, BusinessProcess.Administration"); //DataSet theDS = FacilityManager.GetFacility(); //if (theDS.Tables[0].Rows.Count > 0) //{ // FacilityId = Convert.ToInt32(theDS.Tables[0].Rows[0]["FacilityID"]); // txtfacilityname.Text = theDS.Tables[0].Rows[0]["FacilityName"].ToString(); // txtcountryno.Text = theDS.Tables[0].Rows[0]["CountryID"].ToString(); // txtLPTF.Text = theDS.Tables[0].Rows[0]["PosID"].ToString(); // txtSatelliteID.Text = theDS.Tables[0].Rows[0]["SatelliteID"].ToString(); // // ddsatelliteloc.SelectedValue = theDS.Tables[0].Rows[0]["SatelliteID"].ToString(); // txtGrace.Text = theDS.Tables[0].Rows[0]["AppGracePeriod"].ToString(); // cmbCurrency.SelectedValue = theDS.Tables[0].Rows[0]["Currency"].ToString(); // DateTime Pepfardate; // if (theDS.Tables[0].Rows[0]["PepFarStartDate"] != System.DBNull.Value) // { // Pepfardate = Convert.ToDateTime(theDS.Tables[0].Rows[0]["PepFarStartDate"]); // txtPEPFAR_Fund.Value = Pepfardate.ToString(Session["AppDateFormat"].ToString()); // } // ddBackupDrive.SelectedValue = theDS.Tables[0].Rows[0]["BackupDrive"].ToString(); // //if (theDS.Tables[0].Rows[0]["BackupTime"].ToString() == "00:00:00") // if (theDS.Tables[0].Rows[0]["BackupTime"].ToString() == "") // { // ddBackupTime.SelectedValue = "Select"; // } // else { ddBackupTime.SelectedValue = theDS.Tables[0].Rows[0]["BackupTime"].ToString(); } // //FileLoad.Value = theDS.Tables[0].Rows[0]["Image"].ToString(); // ViewState["LoginImage"] = theDS.Tables[0].Rows[0]["Image"].ToString(); //} //else //{ // Session["AppUserId"] = "1"; //} }