Exemplo n.º 1
0
        public static SubStatusMaster Save(SubStatusMaster objSubStatus)
        {
            if (objSubStatus.SubStatusId == 0)
            {
                //objProducer.InsertBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
                objSubStatus.InsertDate        = DateTime.Now;
                objSubStatus.InsertMachineInfo = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
                DbContextHelper.DbContext.Add(objSubStatus);
            }

            //secUser.UpdatedBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
            objSubStatus.UpdateMachineIfo = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
            objSubStatus.UpdateDate       = DateTime.Now;
            DbContextHelper.DbContext.SaveChanges();

            return(objSubStatus);
        }
Exemplo n.º 2
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.º 3
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.º 4
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);
                }
            }
        }
Exemplo n.º 5
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);
            }
        }