Example #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;
     try
     {
         bool exists = WindPolicyManager.IsExist(txtWindPolicy.Text.Trim(), Convert.ToInt32(hdId.Value));
         if (exists)
         {
             lblMessage.Text    = "Wind Policy allready exists.";
             lblMessage.Visible = true;
             txtWindPolicy.Focus();
             return;
         }
         WindPolicyMaster obj = WindPolicyManager.GetbyWindPolicyId(Convert.ToInt32(hdId.Value));
         obj.WindPolicy = txtWindPolicy.Text;
         obj.Status     = true;
         WindPolicyManager.Save(obj);
         saveMsg = hdId.Value == "0" ? "Record Saved Sucessfully." : "Record Updated Sucessfully.";
         btnCancel_Click(null, null);
         lblSave.Text    = saveMsg;
         lblSave.Visible = true;
     }
     catch (Exception ex)
     {
         lblError.Visible = true;
         lblError.Text    = "Record Not Saved !!!";
     }
 }
        public static WindPolicyMaster Save(WindPolicyMaster objWindPolicyMaster)
        {
            if (objWindPolicyMaster.WindPolicyId == 0)
            {
                //objProducer.InsertBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
                objWindPolicyMaster.InsertDate = DateTime.Now;
                objWindPolicyMaster.InsertMachineInfo = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
                DbContextHelper.DbContext.AddToWindPolicyMasters(objWindPolicyMaster);
            }

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

            return objWindPolicyMaster;
        }
Example #3
0
        public static WindPolicyMaster Save(WindPolicyMaster objWindPolicyMaster)
        {
            if (objWindPolicyMaster.WindPolicyId == 0)
            {
                //objProducer.InsertBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
                objWindPolicyMaster.InsertDate        = DateTime.Now;
                objWindPolicyMaster.InsertMachineInfo = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
                DbContextHelper.DbContext.AddToWindPolicyMasters(objWindPolicyMaster);
            }

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

            return(objWindPolicyMaster);
        }