Esempio n. 1
0
        private void Delete(string id)
        {
            BD_MaintenanceData data = new BD_MaintenanceData();
            ITransaction tran = factory.GetLoadObject(data, Func.ParseString(id));
            Execute(tran);
            if (!HasError)
            {
                //Get Data
                data = (BD_MaintenanceData)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);
                }
                else
                {
                    OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionUpdateId, deleteUnSuccess, Page.User.Identity.Name);
                    mvMessage.AddError(deleteUnSuccess);
                }
                ShowData();
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Update
        /// </summary>
        private void UpdateData()
        {
            BD_MaintenanceData data = new BD_MaintenanceData();
            ITransaction tran = factory.GetLoadObject(data, hidId.Value);
            Execute(tran);
            if (!HasError)
            {
                //Get Data
                data = (BD_MaintenanceData)tran.Result;
                data.ModifiedBy = Page.User.Identity.Name;
                data.Modified = DateTime.Now.ToString("yyyyMMddHHmmss");
                data.DelFlag = true.Equals(chkDelFlag.Checked) ? "0" : "1";

                data.ExecDate = Func.FormatYYYYmmdd(txtExecDate.Text);
                data.ExecDescription = txtExecDescription.Text;
                data.ExecComment = txtExecComment.Text;
                data.ExecCompany = txtExecCompany.Text;
                data.ExecConfirmer = txtExecConfirmer.Text;

                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);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Init values
        /// </summary>
        protected override void DoInit()
        {
            id = Request["id"];

            hidId.Value = id;
            chkDelFlag.Enabled = DbHelper.isAdmin(Page.User.Identity.Name);

            BD_MaintenanceData data = new BD_MaintenanceData();
            ITransaction tran = factory.GetLoadObject(data, id);
            Execute(tran);
            if (!HasError)
            {
                //Get Data
                data = (BD_MaintenanceData)tran.Result;
                txtYear.Text = data.Year;
                txtMonth.Text = data.Month;
                txtWeek.Text = data.Week;
                txtMainName.Text = data.MainName;
                txtSubName.Text = data.SubName;
                txtExecDate.Text = Func.FormatDMY(data.ExecDate);
                txtExecDescription.Text = data.ExecDescription;
                txtExecComment.Text = data.ExecComment;
                txtExecCompany.Text = data.ExecCompany;
                txtExecConfirmer.Text = data.ExecConfirmer;

                lblCreated.Text = !"".Equals(data.Created) ? data.CreatedBy + "(" + Func.Formatdmyhms(data.Created) + ")" : "";
                lblModified.Text = !"".Equals(data.Modified) ? data.ModifiedBy + "(" + Func.Formatdmyhms(data.Modified) + ")" : "";

                hidId.Value = id;
            }

        }