Exemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            lblError.Text      = string.Empty;
            lblError.Visible   = false;
            lblSave.Text       = string.Empty;
            lblSave.Visible    = false;
            lblMessage.Visible = false;
            lblMessage.Text    = string.Empty;

            int clientID = Core.SessionHelper.getClientId();

            try {
                using (TransactionScope scope = new TransactionScope()) {
                    bool exists = SubStatusManager.IsExist(txtSubStatus.Text.Trim(), clientID);
                    if (exists)
                    {
                        lblMessage.Text    = "Sub Status name already exists.";
                        lblMessage.Visible = true;
                        txtSubStatus.Focus();
                        return;
                    }
                    SubStatusMaster status = SubStatusManager.GetSubStatusId(Convert.ToInt32(hdId.Value));
                    status.SubStatusName = txtSubStatus.Text;
                    status.Status        = true;

                    // 2013-09-20
                    status.clientID = clientID;

                    SubStatusManager.Save(status);
                    lblSave.Text = hdId.Value == "0" ? "Record Saved Successfully." : "Record Updated Successfully.";

                    lblSave.Visible = true;
                    scope.Complete();
                }
                clearFields();
            }
            catch (Exception ex) {
                lblError.Visible = true;
                lblError.Text    = "Record Not Saved!";

                Core.EmailHelper.emailError(ex);
            }
        }
Exemplo n.º 2
0
        private void copyMasterSubStatus(int sourceClientID, int targetClientID, int clientUserID)
        {
            List <SubStatusMaster> statuses = null;

            // get list of status from model
            statuses = SubStatusManager.GetAll(sourceClientID);
            foreach (SubStatusMaster status in statuses)
            {
                SubStatusMaster newStatusMaster = new SubStatusMaster();
                newStatusMaster.clientID   = targetClientID;
                newStatusMaster.InsertBy   = clientUserID;
                newStatusMaster.InsertDate = DateTime.Now;
                newStatusMaster.Status     = status.Status;
                newStatusMaster.UpdateBy   = clientUserID;
                newStatusMaster.UpdateDate = DateTime.Now;

                SubStatusManager.Save(newStatusMaster);
            }
        }
Exemplo n.º 3
0
        protected void gv_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            SubStatusMaster leadStatus = null;
            int             statusId   = 0;

            if (e.CommandName.Equals("DoEdit"))
            {
                statusId = Convert.ToInt32(e.CommandArgument);

                leadStatus = SubStatusManager.GetSubStatusId(statusId);

                if (leadStatus != null)
                {
                    hdId.Value = statusId.ToString();

                    txtSubStatus.Text = leadStatus.SubStatusName;
                }
            }
            else if (e.CommandName.Equals("DoDelete"))
            {
                // In Case of delete
                try {
                    var status = SubStatusManager.GetSubStatusId(Convert.ToInt32(e.CommandArgument));
                    status.Status = false;

                    SubStatusManager.Save(status);

                    lblSave.Text    = "Record Deleted Successfully.";
                    lblSave.Visible = true;
                }
                catch (Exception ex) {
                    lblError.Text    = "Record Not Deleted.";
                    lblError.Visible = true;

                    Core.EmailHelper.emailError(ex);
                }
            }
        }