private Boolean FieldValidation() { DataTable dtretout = new DataTable(); ICustomList CustomManager; CustomManager = (ICustomList)ObjectFactory.CreateInstance("BusinessProcess.Administration.BCustomList,BusinessProcess.Administration"); if (txtName.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = lblName.Text; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); txtName.Focus(); return(false); } if (txtSeqNo.Text.Trim() == "" && ddStatus.SelectedValue != "1") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Priority"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); txtSeqNo.Focus(); return(false); } if (txtSeqNo.Text == "0") { IQCareMsgBox.Show("ChkPriority", this); return(false); } if (ViewState["TableName"].ToString() == "Frequency") { if (rdinteger.Checked) { if (txtmultiplier.Text == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Integer"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); txtmultiplier.Focus(); return(false); } } } //if (btnSave.Text == "Save") //{ // dtretout = CustomManager.GetDecode(Convert.ToString(ViewState["TableName"]), txtName.Text, 1, 0); //} //else //{ // dtretout = CustomManager.GetDecode(Convert.ToString(ViewState["TableName"]), txtName.Text, 2, Convert.ToInt32(Session["UpdateID"].ToString())); //} //if (dtretout.Rows.Count > 0) //{ // if (dtretout.Rows[0]["Result"].ToString() == "-2") // { // string script = "<script language = 'javascript' defer ='defer' id = 'confirm'>\n"; // script += "var ans=true;\n"; // script += "alert('Name already exists');\n"; // script += "</script>\n"; // RegisterStartupScript("confirm", script); // } // else if (dtretout.Rows[0]["Result"].ToString() == "0") // { // return true; // } // return false; //} //---- Rupesh---- if ((lblName.Text.ToString().Trim() == "Laboratory Unit :") && (ddStatus.SelectedValue == "1")) { //----check if default value of this Lab Unit is 1 ---- ILabMst LabManager; LabManager = (ILabMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BLabMst, BusinessProcess.Administration"); DataTable theDT = LabManager.CheckDefaultUnit(Convert.ToInt32(ViewState["Id"])); if (theDT.Rows.Count > 0) { if (theDT.Rows[0]["unitID"].ToString() == ViewState["Id"].ToString()) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = theDT.Rows[0]["SubTestName"].ToString(); IQCareMsgBox.Show("CannotInactivateUnit", theBuilder, this); ddStatus.Focus(); return(false); } } } return(true); }
/// <summary> /// Fields the validation. /// </summary> /// <returns></returns> private Boolean FieldValidation() { DataTable dtretout = new DataTable(); ICustomList CustomManager; CustomManager = (ICustomList)ObjectFactory.CreateInstance("BusinessProcess.Administration.BCustomList,BusinessProcess.Administration"); if (txtName.Text.Trim() == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = lblName.Text; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); txtName.Focus(); return(false); } if (txtSeqNo.Text.Trim() == "" && ddStatus.SelectedValue != "1") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Priority"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); txtSeqNo.Focus(); return(false); } if (txtSeqNo.Text == "0") { IQCareMsgBox.Show("ChkPriority", this); return(false); } if (ViewState["TableName"].ToString() == "Frequency") { if (rdinteger.Checked) { if (txtmultiplier.Text == "") { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = "Integer"; IQCareMsgBox.Show("BlankTextBox", theBuilder, this); txtmultiplier.Focus(); return(false); } } } //---- Rupesh---- if ((lblName.Text.ToString().Trim() == "Laboratory Unit :") && (ddStatus.SelectedValue == "1")) { //----check if default value of this Lab Unit is 1 ---- ILabMst LabManager; LabManager = (ILabMst)ObjectFactory.CreateInstance("BusinessProcess.Administration.BLabMst, BusinessProcess.Administration"); DataTable theDT = LabManager.CheckDefaultUnit(Convert.ToInt32(ViewState["Id"])); if (theDT.Rows.Count > 0) { if (theDT.Rows[0]["unitID"].ToString() == ViewState["Id"].ToString()) { MsgBuilder theBuilder = new MsgBuilder(); theBuilder.DataElements["Control"] = theDT.Rows[0]["SubTestName"].ToString(); IQCareMsgBox.Show("CannotInactivateUnit", theBuilder, this); ddStatus.Focus(); return(false); } } } return(true); }