Пример #1
0
 protected void txtLeaveName_OnTextChanged(object sender, EventArgs e)
 {
     if (editid.Value == "")
     {
         DataTable dt = objLeave.GetLeaveMasterByLeaveName(Session["CompId"].ToString().ToString(), txtLeaveName.Text.Trim());
         if (dt.Rows.Count > 0)
         {
             txtLeaveName.Text = "";
             DisplayMessage("Leave Type Name Already Exists");
             System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtLeaveName);
             return;
         }
         DataTable dt1 = objLeave.GetLeaveMasterInactive(Session["CompId"].ToString().ToString());
         dt1 = new DataView(dt1, "Leave_Name='" + txtLeaveName.Text + "'", "", DataViewRowState.CurrentRows).ToTable();
         if (dt1.Rows.Count > 0)
         {
             txtLeaveName.Text = "";
             DisplayMessage("Leave Type Name Already Exists - Go to Bin Tab");
             System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtLeaveName);
             return;
         }
         txtLeaveNameL.Focus();
     }
     else
     {
         DataTable dtTemp = objLeave.GetLeaveMasterById(Session["CompId"].ToString().ToString(), editid.Value);
         if (dtTemp.Rows.Count > 0)
         {
             if (dtTemp.Rows[0]["Leave_Name"].ToString() != txtLeaveName.Text)
             {
                 DataTable dt = objLeave.GetLeaveMaster(Session["CompId"].ToString().ToString());
                 dt = new DataView(dt, "Leave_Name='" + txtLeaveName.Text + "'", "", DataViewRowState.CurrentRows).ToTable();
                 if (dt.Rows.Count > 0)
                 {
                     txtLeaveName.Text = "";
                     DisplayMessage("Leave Type Name Already Exists");
                     System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtLeaveName);
                     return;
                 }
                 DataTable dt1 = objLeave.GetLeaveMaster(Session["CompId"].ToString().ToString());
                 dt1 = new DataView(dt1, "Leave_Name='" + txtLeaveName.Text + "'", "", DataViewRowState.CurrentRows).ToTable();
                 if (dt1.Rows.Count > 0)
                 {
                     txtLeaveName.Text = "";
                     DisplayMessage("Leave Type Name Already Exists - Go to Bin Tab");
                     System.Web.UI.ScriptManager.GetCurrent(this).SetFocus(txtLeaveName);
                     return;
                 }
             }
         }
         txtLeaveNameL.Focus();
     }
 }
Пример #2
0
    public static string[] GetCompletionListLeaveName(string prefixText, int count, string contextKey)
    {
        LeaveMaster objLeaveMaster = new LeaveMaster();
        DataTable   dt             = new DataView(objLeaveMaster.GetLeaveMaster(HttpContext.Current.Session["CompId"].ToString()), "Leave_Name like '" + prefixText.ToString() + "%'", "", DataViewRowState.CurrentRows).ToTable();

        string[] txt = new string[dt.Rows.Count];

        for (int i = 0; i < dt.Rows.Count; i++)
        {
            txt[i] = dt.Rows[i]["Leave_Name"].ToString();
        }
        return(txt);
    }