Exemplo n.º 1
0
        /// <summary>
        /// Insert data
        /// </summary>
        private void InsertData()
        {
            //Get and Insert Data
            CustomerCommingDocData data = new CustomerCommingDocData();
            ITransaction tran = factory.GetInsertObject(data);
            data.CustomerId = hidId.Value;
            data.CommingDocName = txtCommingDocName.Text.Trim();
            data.CommingDocMount = txtCommingDocMount.Text.Trim();
            data.CommingDate = Func.FormatYYYYmmdd(txtCommingDate.Text.Trim());
            data.Comment = txtComment.Text.Trim();

            data.BuildingId = Func.ParseString(Session["__BUILDINGID__"]);

            data.ModifiedBy = Page.User.Identity.Name;
            data.CreatedBy = Page.User.Identity.Name;
            data.Created = DateTime.Now.ToString("yyyyMMddHHmmss");
            data.Modified = DateTime.Now.ToString("yyyyMMddHHmmss");
            data.DelFlag = "0";

            Execute(tran);

            if (!HasError)
            {
                OperationLogger.WriteInfo(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addSuccess, Page.User.Identity.Name);
                mvMessage.SetCompleteMessage(addSuccess);
                ScriptManager.RegisterClientScriptBlock(this.btnRegister, this.GetType(), key, postback, true);

                txtCommingDate.Text = "";
                txtCommingDocMount.Text = "";
                txtCommingDate.Text = "";
                txtComment.Text = "";

                ShowData();
            }
            else
            {
                OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addUnSuccess, Page.User.Identity.Name);
                mvMessage.AddError(addUnSuccess);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Update
        /// </summary>
        private void DeleteData(string strId)
        {
            CustomerCommingDocData data = new CustomerCommingDocData();
            ITransaction tran = factory.GetLoadObject(data, strId);
            Execute(tran);
            if (!HasError)
            {
                //Get Data
                data = (CustomerCommingDocData)tran.Result;
                data.DelFlag = "1";
                tran = factory.GetUpdateObject(data);

                Execute(tran);

                if (!HasError)
                {
                    OperationLogger.WriteInfo(Constants.LogOperationAlbumId, Constants.LogActionUpdateId, deleteSuccess, Page.User.Identity.Name);
                    mvMessage.SetCompleteMessage(deleteSuccess);
                    ScriptManager.RegisterClientScriptBlock(this.btnRegister, this.GetType(), key, postback, true);
                }
                else
                {
                    OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionUpdateId, updateUnSuccess, Page.User.Identity.Name);
                    mvMessage.AddError(updateUnSuccess);
                }
            }
        }