コード例 #1
0
ファイル: StaffOfCustList.aspx.cs プロジェクト: tuankyo/QLTN
        /// <summary>
        /// Insert data
        /// </summary>
        protected void btnRegister_Click(object sender, EventArgs e)
        {
            //Get and Insert Data
            StaffOfCustomerData data = new StaffOfCustomerData();
            ITransaction tran = factory.GetInsertObject(data);
            data.Name = txtName.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";

            data.Phone = txtPhone.Text;
            data.Address = txtAddress.Text;
            data.Mail = txtMail.Text;
            data.CustomerId = hidID.Value;

            Execute(tran);

            if (!HasError)
            {
                OperationLogger.WriteInfo(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addSuccess, Page.User.Identity.Name);
                mvMessage.SetCompleteMessage(addSuccess);
                ShowData();
            }
            else
            {
                OperationLogger.WriteError(Constants.LogOperationAlbumId, Constants.LogActionInsertId, addUnSuccess, Page.User.Identity.Name);
                mvMessage.AddError(addUnSuccess);
            }
        }
コード例 #2
0
ファイル: StaffOfCustEdit.aspx.cs プロジェクト: tuankyo/QLTN
        /// <summary>
        /// Update
        /// </summary>
        private void UpdateData()
        {
            StaffOfCustomerData data = new StaffOfCustomerData();
            ITransaction tran = factory.GetLoadObject(data, hidId.Value);
            Execute(tran);
            if (!HasError)
            {
                //Get Data
                data = (StaffOfCustomerData)tran.Result;
                data.Name = txtName.Text.Trim();
                data.Comment = txtComment.Text.Trim();

                data.ModifiedBy = Page.User.Identity.Name;
                data.Modified = DateTime.Now.ToString("yyyyMMddHHmmss");
                data.DelFlag =  true.Equals(chkDelFlag.Checked) ? "0" : "1";

                data.Phone = txtPhone.Text;
                data.Address = txtAddress.Text;
                data.Mail = txtMail.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);
                }
            }
        }
コード例 #3
0
ファイル: StaffOfCustList.aspx.cs プロジェクト: tuankyo/QLTN
        /// <summary>
        /// Update
        /// </summary>
        private void DeleteData(string strId)
        {
            StaffOfCustomerData data = new StaffOfCustomerData();
            ITransaction tran = factory.GetLoadObject(data, strId);
            Execute(tran);
            if (!HasError)
            {
                //Get Data
                data = (StaffOfCustomerData)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);
                }
            }
        }
コード例 #4
0
ファイル: StaffOfCustEdit.aspx.cs プロジェクト: tuankyo/QLTN
        /// <summary>
        /// Load data
        /// </summary>
        private void LoadData()
        {
            StaffOfCustomerData data = new StaffOfCustomerData();
            ITransaction tran = factory.GetLoadObject(data, id);
            Execute(tran);
            if (!HasError)
            {
                //Get Data
                data = (StaffOfCustomerData)tran.Result;
                txtName.Text = data.Name;
                txtComment.Text = data.Comment;

                txtPhone.Text = data.Phone;
                txtAddress.Text = data.Address;
                txtMail.Text = data.Mail;

                chkDelFlag.Checked =  "1".Equals(data.DelFlag) ? false : true;

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