コード例 #1
0
        /// <summary>
        /// Update
        /// </summary>
        //private void UpdateData()
        //{
        //    BD_TicketStubsPayData data = new BD_TicketStubsPayData();
        //    ITransaction tran = factory.GetLoadObject(data, hidId.Value);
        //    Execute(tran);
        //    if (!HasError)
        //    {
        //        //Get Data
        //        data = (BD_TicketStubsPayData)tran.Result;
        //        data.Used = txtUsedMount.Text.Trim();
        //        data.UsedMount = txtUsedMount.Text.Trim();
        //        data.UsedReceiveFrom = txtUsedReceiveFrom.Text.Trim();
        //        data.UsedDate = !"".Equals(txtUsedDate.Text.Trim()) ? Func.FormatYYYYmmdd(txtUsedDate.Text.Trim()) : "";
        //        data.UsedReceiver = txtUsedReceiver.Text.Trim();
        //        data.UsedComment = txtUsedComment.Text.Trim();
        //        tran = factory.GetUpdateObject(data);
        //        Execute(tran);
        //        if (!HasError)
        //        {
        //            OperationLogger.WriteInfo(Constants.LogOperationAlbumId, Constants.LogActionUpdateId, updateSuccess, Page.User.Identity.Name);
        //            mvMessage.SetCompleteMessage(updateSuccess);
        //            ScriptManager.RegisterClientScriptBlock(this.btnRegister, this.GetType(), key, postback, true);
        //            lblCreated.Text = !"".Equals(data.Created) ? data.CreatedBy + "(" + Func.Formatdmyhms(data.Created) + ")" : "";
        //            lblModified.Text = !"".Equals(data.Modified) ? data.ModifiedBy + "(" + Func.Formatdmyhms(data.Modified) + ")" : "";
        //        }
        //        else
        //        {
        //            OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionUpdateId, updateUnSuccess, Page.User.Identity.Name);
        //            mvMessage.AddError(updateUnSuccess);
        //        }
        //    }
        //}
        /// <summary>
        /// Insert data
        /// </summary>
        private void InsertData()
        {
            //Get and Insert Data
            BD_TicketStubsPayData data = new BD_TicketStubsPayData();
            ITransaction tran = factory.GetInsertObject(data);
            data.SeriNumber = lblSeriNumber.Text.Trim();
            data.UsedDate = !"".Equals(txtUsedDate.Text.Trim()) ? Func.FormatYYYYmmdd(txtUsedDate.Text.Trim()) : "";

            data.UsedReceiveFrom = txtUsedReceiveFrom.Text.Trim();
            data.UsedReceiver = txtUsedReceiver.Text.Trim();
            data.UsedMount = txtUsedMount.Text.Trim();
            data.UsedPrice = txtUsedPrice.Text.Trim();
            data.UsedSum = "" + Func.ParseInt(txtUsedMount.Text.Trim()) * Func.ParseInt(txtUsedPrice.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";
            data.BuildingId = Func.ParseString(Session["__BUILDINGID__"]);
            data.PaidSeriNumber = txtPaidSeriNumber.Text;

            data.UsedComment = txtUsedComment.Text;

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

                btnRegister.CommandName = "Register";
                hidAction.Value = "Edit";
                hidId.Value = data.id;
                lblSeriNumber.Enabled = false;

                lblCreated.Text = !"".Equals(data.Created) ? data.CreatedBy + "(" + Func.Formatdmyhms(data.Created) + ")" : "";
                lblModified.Text = !"".Equals(data.Modified) ? data.ModifiedBy + "(" + Func.Formatdmyhms(data.Modified) + ")" : "";
                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_TicketStubsPayData data = new BD_TicketStubsPayData();
            ITransaction tran = factory.GetLoadObject(data, strId);
            Execute(tran);
            if (!HasError)
            {
                //Get Data
                data = (BD_TicketStubsPayData)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);
                }
            }
        }