Example #1
0
        protected void chkFinYear_OnCheckedChanged(object sender, EventArgs e)
        {
            try
            {
                int         selRowIndex = ((GridViewRow)(((CheckBox)sender).Parent.Parent)).RowIndex;
                CheckBox    cb          = (CheckBox)GridYear.Rows[selRowIndex].FindControl("chkFinYear");
                HiddenField YearDate1   = (HiddenField)GridYear.Rows[selRowIndex].FindControl("HfYRDT1");

                if (cb.Checked)
                {
                    //ADD

                    string str = COMPANYLogicLayer.InsertUSER_YEARS_RIGHTSDetail(DdlCompany.SelectedValue.ToString(), DdlUser.SelectedValue.ToString(), YearDate1.Value);
                    if (str.Contains("successfully"))
                    {
                        lblmsg.Text      = "YEAR ADD SUCCESSFULLY.";
                        lblmsg.ForeColor = Color.Green;
                    }
                    else if (str.Contains("Already") || str.Contains("PRIMARY KEY"))
                    {
                        lblmsg.Text      = "YEAR ALREADY EXIST.";
                        lblmsg.ForeColor = Color.Red;
                    }
                    else
                    {
                        lblmsg.Text      = "ERROR : YEAR NOT ASSIGNED";
                        lblmsg.ForeColor = Color.Red;
                    }
                }

                else
                {
                    //REMOVE

                    string str = COMPANYLogicLayer.DELETEUSER_YEARS_RIGHTSDetail(DdlCompany.SelectedValue.ToString(), DdlUser.SelectedValue.ToString(), YearDate1.Value);
                    if (str.Contains("successfully"))
                    {
                        lblmsg.Text      = "YEAR REMOVED SUCCESSFULLY.";
                        lblmsg.ForeColor = Color.Green;
                    }
                    else if (str.Contains("Already") || str.Contains("PRIMARY KEY"))
                    {
                        lblmsg.Text      = "YEAR ALREADY EXIST.";
                        lblmsg.ForeColor = Color.Red;
                    }
                    else
                    {
                        lblmsg.Text      = "ERROR : YEAR NOT REMOVED";
                        lblmsg.ForeColor = Color.Red;
                    }
                }

                FillFinYears();
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
 protected void GridYear_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Adda")
         {
             string str = COMPANYLogicLayer.InsertUSER_YEARS_RIGHTSDetail(DdlCompany.SelectedValue.ToString(), DdlUser.SelectedValue.ToString(), e.CommandArgument.ToString());
             if (str.Contains("successfully"))
             {
                 lblmsg.Text      = "YEAR ADD SUCCESSFULLY.";
                 lblmsg.ForeColor = Color.Green;
             }
             else if (str.Contains("Already") || str.Contains("PRIMARY KEY"))
             {
                 lblmsg.Text      = "YEAR ALREADY EXIST.";
                 lblmsg.ForeColor = Color.Red;
             }
             else
             {
                 lblmsg.Text      = "ERROR : YEAR NOT ASSIGNED";
                 lblmsg.ForeColor = Color.Red;
             }
         }
         else if (e.CommandName == "Removea")
         {
             string str = COMPANYLogicLayer.DELETEUSER_YEARS_RIGHTSDetail(DdlCompany.SelectedValue.ToString(), DdlUser.SelectedValue.ToString(), e.CommandArgument.ToString());
             if (str.Contains("successfully"))
             {
                 lblmsg.Text      = "YEAR REMOVED SUCCESSFULLY.";
                 lblmsg.ForeColor = Color.Green;
             }
             else if (str.Contains("Already") || str.Contains("PRIMARY KEY"))
             {
                 lblmsg.Text      = "YEAR ALREADY EXIST.";
                 lblmsg.ForeColor = Color.Red;
             }
             else
             {
                 lblmsg.Text      = "ERROR : YEAR NOT REMOVED";
                 lblmsg.ForeColor = Color.Red;
             }
         }
         FillFinYears();
     }
     catch (Exception)
     {
         throw;
     }
 }