示例#1
0
        /// <summary>
        /// Insert data
        /// </summary>
        private void InsertData()
        {
            mvMessage.CheckRequired(txtProcessDate, "Ngày xuất kho: Danh mục bắt bắt buộc nhập");
            mvMessage.CheckRequired(txtExporter, "Người thực hiện: Danh mục bắt bắt buộc nhập");
            mvMessage.CheckRequired(txtApprover, "Người xử lý: Danh mục bắt bắt buộc nhập");
            mvMessage.CheckRequired(txtMount, "Số lượng: Danh mục bắt bắt buộc nhập");

            if (!mvMessage.IsValid) return;

            //Get and Insert Data
            BD_SuppliesEximData data = new BD_SuppliesEximData();
            ITransaction tran = factory.GetInsertObject(data);
            data.SuppliesId = hidId.Value;
            data.ProcessDate = Func.FormatYYYYmmdd(txtProcessDate.Text.Trim());
            data.Exporter = txtExporter.Text.Trim();
            data.Approver = txtApprover.Text.Trim();
            data.ProcessType = "-1";
            data.Mount = txtMount.Text.Trim();
            data.Comment = txtComment.Text.Trim();

            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);

                txtProcessDate.Text = "";
                txtComment.Text = "";

                ShowData();
            }
            else
            {
                OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addUnSuccess, Page.User.Identity.Name);
                mvMessage.AddError(addUnSuccess);
            }
        }
示例#2
0
        /// <summary>
        /// Update
        /// </summary>
        private void DeleteData(string strId)
        {
            BD_SuppliesEximData data = new BD_SuppliesEximData();
            ITransaction tran = factory.GetLoadObject(data, strId);
            Execute(tran);
            if (!HasError)
            {
                //Get Data
                data = (BD_SuppliesEximData)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);
                }
            }
        }