private void GridTemplateBind()
        {
            try
            {
                TrustTemplateBl   objTrustItemBl = new TrustTemplateBl();
                ApplicationResult objResult      = new ApplicationResult();

                objResult = objTrustItemBl.TrustTemplate_SelectAll(Convert.ToInt32(Session[ApplicationSession.TRUSTID]));
                if (objResult != null)
                {
                    gvTemplates.DataSource = objResult.resultDT;
                    gvTemplates.DataBind();
                    if (objResult.resultDT.Rows.Count > 0)
                    {
                        gvPayTemplate.Visible = true;
                    }
                    else
                    {
                        gvPayTemplate.Visible = false;
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }
        public void BindTemplateName()
        {
            try
            {
                TrustTemplateBl   ObjTrustTemplateBl = new TrustTemplateBl();
                ApplicationResult objResult          = new ApplicationResult();
                Controls          objControls        = new Controls();

                objResult = ObjTrustTemplateBl.TrustTemplate_SelectAll(Convert.ToInt32(Session[ApplicationSession.TRUSTID]));
                if (objResult != null)
                {
                    if (objResult.resultDT.Rows.Count > 0)
                    {
                        objControls.BindDropDown_ListBox(objResult.resultDT, ddlSelectTemplateName, "TrustTemplateName", "TrustTemplateID");
                        ddlSelectTemplateName.Items.Insert(0, new ListItem("-Select-", ""));
                    }
                    else
                    {
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "divShow();", true);
                        btnSave.Visible = true;
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }
        protected void gvTemplates_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                TrustTemplateBl   objTrustItemBl = new TrustTemplateBl();
                ApplicationResult objResult      = new ApplicationResult();
                ViewState["TrustTemplateID"] = Convert.ToInt32(e.CommandArgument.ToString());
                if (e.CommandName.ToString() == "Edit1")
                {
                    objResult = objTrustItemBl.TrustTemplate_Select(Convert.ToInt32(ViewState["TrustTemplateID"].ToString()));

                    if (objResult != null)
                    {
                        if (objResult.resultDT.Rows.Count > 0)
                        {
                            txtTemplateName.Text = objResult.resultDT.Rows[0][TrustTemplateBo.TRUSTTEMPLATE_TRUSTTEMPLATENAME].ToString();
                            ViewState["Mode"]    = "Edit";
                            Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "divShow();", true);
                        }
                    }
                }
                if (e.CommandName.ToString() == "Delete1")
                {
                    Controls objControls = new Controls();
                    //objControls.EnableControls(Master.FindControl("ContentPlaceHolder1"));
                    ApplicationResult objDelete = new ApplicationResult();

                    objDelete = objTrustItemBl.TrustTemplate_Delete(Convert.ToInt32(ViewState["TrustTemplateID"].ToString()), Convert.ToInt32(Session[ApplicationSession.USERID]), DateTime.UtcNow.AddHours(5.5).ToString());
                    if (objDelete.status == ApplicationResult.CommonStatusType.SUCCESS)
                    {
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('Template name deleted successfully.');</script>");
                        Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "divHide();", true);
                        txtTemplateName.Text = "";
                        BindTemplateName();
                        GridTemplateBind();
                    }
                    else
                    {
                        ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='JavaScript'>alert('Template names are assigned to Employee PayRoll So you Can not Delete this.');</script>");
                    }
                }
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }
        public void BindGridView()
        {
            try
            {
                ApplicationResult objResult          = new ApplicationResult();
                TrustTemplateBl   objTrustTemplateBL = new TrustTemplateBl();

                objResult = objTrustTemplateBL.TrustTemplate_SelectAll_PayItemWithAsc(Convert.ToInt32(Session[ApplicationSession.TRUSTID]));
                if (objResult != null)
                {
                    gvPayItem.DataSource = objResult.resultDT;
                    gvPayItem.DataBind();
                    if (objResult.resultDT.Rows.Count > 0)
                    {
                        gvPayItem.Visible = true;

                        ApplicationResult objTrustTemplateResult = new ApplicationResult();
                        TrustPayItemBl    objTrustPayItemBl      = new TrustPayItemBl();
                        objTrustTemplateResult = objTrustPayItemBl.TrustPayItem_SelectAll_AscOrder(Convert.ToInt32(Session[ApplicationSession.TRUSTID]));
                        foreach (GridViewRow row in gvPayItem.Rows)
                        {
                            if (objTrustTemplateResult.resultDT.Rows.Count > 0)
                            {
                                int i;
                                for (i = 0; i < objTrustTemplateResult.resultDT.Rows.Count; i++)
                                {
                                    if (Convert.ToInt32(row.Cells[0].Text) == Convert.ToInt32(objTrustTemplateResult.resultDT.Rows[i][TrustPayItemBo.TRUSTPAYITEM_PAYITEMID].ToString()))
                                    {
                                        ((CheckBox)row.FindControl("CheckBoxPayItem")).Checked = true;
                                        btnSave.Enabled = true;
                                    }
                                }
                            }
                        }
                    }
                }
                btnSave.Visible = true;
                //btnCancel.Visible = true;
            }
            catch (Exception ex)
            {
                logger.Error("Error", ex);
                ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Oops! There is some technical issue. Please Contact to your administrator.');</script>");
            }
        }
Exemple #5
0
        private void BindTemplateName()
        {
            TrustTemplateBl   ObjTrustTemplateBl = new TrustTemplateBl();
            ApplicationResult objResult          = new ApplicationResult();
            Controls          objControls        = new Controls();

            objResult = ObjTrustTemplateBl.TrustTemplate_SelectAll(Convert.ToInt32(Session[ApplicationSession.TRUSTID]));
            if (objResult != null)
            {
                if (objResult.resultDT.Rows.Count > 0)
                {
                    objControls.BindDropDown_ListBox(objResult.resultDT, ddlTemplate, "TrustTemplateName", "TrustTemplateID");
                    ddlTemplate.Items.Insert(0, new ListItem("-Select-", ""));
                }
                else
                {
                    ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script>alert('Please Insert Trust Template');</script>");
                }
            }
        }
        protected void btnAddTemplate_OnClick(object sender, EventArgs e)
        {
            try
            {
                TrustTemplateBo   objTrustTemplateBo  = new TrustTemplateBo();
                ApplicationResult objResult           = new ApplicationResult();
                TrustTemplateBl   ObjTrustTemplatemBl = new TrustTemplateBl();
                if (txtTemplateName.Text != "")
                {
                    objTrustTemplateBo.TrustMID           = Convert.ToInt32(Session[ApplicationSession.TRUSTID]);
                    objTrustTemplateBo.TrustTemplateName  = txtTemplateName.Text.Trim();
                    objTrustTemplateBo.LastModifiedDate   = DateTime.UtcNow.AddHours(5.5).ToString();
                    objTrustTemplateBo.LastModifiedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]);
                    if (ViewState["Mode"].ToString() == "Save")
                    {
                        objTrustTemplateBo.CreatedDate   = DateTime.UtcNow.AddHours(5.5).ToString();
                        objTrustTemplateBo.CreatedUserID = Convert.ToInt32(Session[ApplicationSession.USERID]);

                        objResult = ObjTrustTemplatemBl.TrustTemplate_Insert(objTrustTemplateBo);

                        if (objResult.status == ApplicationResult.CommonStatusType.SUCCESS)
                        {
                            Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "divHide();", true);
                            txtTemplateName.Text = "";
                            BindTemplateName();
                            GridTemplateBind();
                            ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Template Name Saved Successfully.');</script>");
                        }
                        else
                        {
                            ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Template Name already Exists.');</script>");
                        }
                    }
                    else
                    {
                        objTrustTemplateBo.TrustTemplateID = Convert.ToInt32(ViewState["TrustTemplateID"].ToString());
                        objResult = ObjTrustTemplatemBl.TrustTemplate_Update(objTrustTemplateBo);

                        if (objResult.status == ApplicationResult.CommonStatusType.SUCCESS)
                        {
                            Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "divHide();", true);
                            txtTemplateName.Text = "";
                            BindTemplateName();
                            GridTemplateBind();
                            ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Template Name Updated Successfully.');</script>");
                        }
                        else
                        {
                            ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Template Name already Exists.');</script>");
                        }
                    }
                    ViewState["Mode"] = "Save";
                }
                else
                {
                    ClientScript.RegisterStartupScript(typeof(Page), "MessagePopUp", "<script language='javascript'>alert('Write template Name.');</script>");
                }
            }
            catch (Exception ex)
            {
            }
        }