Esempio n. 1
0
 protected void GridCompany_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         if (e.CommandName == "Adda")
         {
             string str = COMPANYLogicLayer.InsertUSER_COMPANY_RIGHTSDetail(e.CommandArgument.ToString(), DdlUser.SelectedValue.ToString());
             if (str.Contains("successfully"))
             {
                 lblmsg.Text      = "COMPANY ADD SUCCESSFULLY.";
                 lblmsg.ForeColor = Color.Green;
             }
             else if (str.Contains("Already") || str.Contains("PRIMARY KEY"))
             {
                 lblmsg.Text      = "COMPANY ALREADY EXIST.";
                 lblmsg.ForeColor = Color.Red;
             }
             else
             {
                 lblmsg.Text      = "ERROR : COMPANY NOT ASSIGNED";
                 lblmsg.ForeColor = Color.Red;
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 2
0
        protected void chkCompany_OnCheckedChanged(object sender, EventArgs e)
        {
            try
            {
                int         selRowIndex = ((GridViewRow)(((CheckBox)sender).Parent.Parent)).RowIndex;
                CheckBox    cb          = (CheckBox)GridCompany.Rows[selRowIndex].FindControl("chkCompany");
                HiddenField CompanyCode = (HiddenField)GridCompany.Rows[selRowIndex].FindControl("HfCOMP_CODE");

                if (cb.Checked)
                {
                    //ADD

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

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


                FillGridCompany();
            }
            catch (Exception)
            {
                throw;
            }
        }