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

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

            return objWebformSource;
        }
Exemplo n.º 2
0
        public static WebformSourceMaster Save(WebformSourceMaster objWebformSource)
        {
            if (objWebformSource.WebformSourceId == 0)
            {
                //objProducer.InsertBy = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
                objWebformSource.InsertDate        = DateTime.Now;
                objWebformSource.InsertMachineInfo = HttpContext.Current.Request.ServerVariables["REMOTE_ADDR"].ToString();
                DbContextHelper.DbContext.AddToWebformSourceMasters(objWebformSource);
            }

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

            return(objWebformSource);
        }
Exemplo n.º 3
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
     {
         using (TransactionScope scope = new TransactionScope())
         {
             bool exists = WebFormSourceManager.IsExist(txtName.Text.Trim(), Convert.ToInt32(hdId.Value));
             if (exists)
             {
                 lblMessage.Text    = "Webform Source already exists.";
                 lblMessage.Visible = true;
                 txtName.Focus();
                 return;
             }
             WebformSourceMaster webformsource = WebFormSourceManager.GetById(Convert.ToInt32(hdId.Value));
             webformsource.WebformSource = txtName.Text;
             webformsource.Status        = true;
             WebFormSourceManager.Save(webformsource);
             saveMsg = hdId.Value == "0" ? "Record Saved Sucessfully." : "Record Updated Sucessfully.";
             btnCancel_Click(null, null);
             lblSave.Text    = saveMsg;
             lblSave.Visible = true;
             scope.Complete();
         }
     }
     catch (Exception ex)
     {
         lblError.Visible = true;
         lblError.Text    = "Record Not Saved !!!";
     }
 }