Example #1
0
        private void repositoryItemHyperLinkEdit1_Click(object sender, EventArgs e)
        {
            Model.PCExportReportANSIDetail model = this.bindingSource1.Current as Model.PCExportReportANSIDetail;
            DetailsForm f = new DetailsForm(model);

            f.ShowDialog();
        }
 private void Validate(Model.PCExportReportANSIDetail pcExp)
 {
     if (string.IsNullOrEmpty(pcExp.PCExportReportANSIDetailId))
     {
         throw new Helper.RequireValueException(Model.PCExportReportANSIDetail.PRO_PCExportReportANSIDetailId);
     }
     if (string.IsNullOrEmpty(pcExp.CheckDate.ToString()))
     {
         throw new Helper.RequireValueException(Model.PCExportReportANSIDetail.PRO_CheckDate);
     }
     if (string.IsNullOrEmpty(pcExp.InvoiceCusXOId))
     {
         throw new Helper.RequireValueException(Model.PCExportReportANSIDetail.PRO_InvoiceCusXOId);
     }
     if (!pcExp.MustCheckSum.HasValue)
     {
         throw new Helper.RequireValueException(Model.PCExportReportANSIDetail.PRO_MustCheckSum);
     }
     if (!pcExp.HasCheckSum.HasValue)
     {
         throw new Helper.RequireValueException(Model.PCExportReportANSIDetail.PRO_HasCheckSum);
     }
     if (pcExp.HasCheckSum.Value < 0)
     {
         throw new Helper.InvalidValueException(Model.PCExportReportANSIDetail.PRO_HasCheckSum);
     }
     if (pcExp.PassSum.Value < 0)
     {
         throw new Helper.InvalidValueException(Model.PCExportReportANSIDetail.PRO_PassSum);
     }
 }
Example #3
0
 protected override void MoveLast()
 {
     if (sign == 1)
     {
         sign = 0;
         return;
     }
     this._pcExpANSIDetail = this._pcExpANSIDetailManager.Get(this._pcExpANSIDetailManager.mGetLast(this._FromPC) == null ? "" : this._pcExpANSIDetailManager.mGetLast(this._FromPC).PCExportReportANSIDetailId);
 }
Example #4
0
        protected override void MoveNext()
        {
            Model.PCExportReportANSIDetail pcExpANSIDeta = this._pcExpANSIDetailManager.mGetNext(this._pcExpANSIDetail.InsertTime.Value, this._FromPC);
            if (pcExpANSIDeta == null)
            {
                throw new InvalidOperationException(Properties.Resources.ErrorNoMoreRows);
            }

            this._pcExpANSIDetail = this._pcExpANSIDetailManager.Get(pcExpANSIDeta.PCExportReportANSIDetailId);
        }
Example #5
0
        protected override void AddNew()
        {
            this._pcExpANSIDetail = new Book.Model.PCExportReportANSIDetail();
            this._pcExpANSIDetail.PCExportReportANSIDetailId = this._pcExpANSIDetailManager.GetId();
            this._pcExpANSIDetail.FromPC       = this._FromPC.Substring(this._FromPC.IndexOf('-') + 1);
            this._pcExpANSIDetail.CheckDate    = DateTime.Now;
            this._pcExpANSIDetail.Employee     = BL.V.ActiveOperator.Employee;
            this._pcExpANSIDetail.MustCheckSum = 0;

            this._mailAccessorList.Clear();
        }
Example #6
0
 public DetailsForm(Model.PCExportReportANSIDetail model)
     : this()
 {
     if (model != null)
     {
         this._pcExpANSIDetail = this._pcExpANSIDetailManager.Get(model.PCExportReportANSIDetailId);
         if (this._pcExpANSIDetail != null)
         {
             sign = 1;
         }
         this.Text   = model.Type;
         this.action = "view";
     }
 }
        public void Insert(Model.PCExportReportANSIDetail pCExportReportANSIDetail)
        {
            Validate(pCExportReportANSIDetail);

            try
            {
                BL.V.BeginTransaction();

                pCExportReportANSIDetail.InsertTime = DateTime.Now;
                pCExportReportANSIDetail.UpdateTime = DateTime.Now;

                TiGuiExists(pCExportReportANSIDetail);

                string invoiceKind   = this.GetInvoiceKind().ToLower();
                string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, pCExportReportANSIDetail.InsertTime.Value.Year);
                string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, pCExportReportANSIDetail.InsertTime.Value.Year, pCExportReportANSIDetail.InsertTime.Value.Month);
                string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, pCExportReportANSIDetail.InsertTime.Value.ToString("yyyy-MM-dd"));
                string sequencekey   = string.Format(invoiceKind);

                SequenceManager.Increment(sequencekey_y);
                SequenceManager.Increment(sequencekey_m);
                SequenceManager.Increment(sequencekey_d);
                SequenceManager.Increment(sequencekey);

                accessor.Insert(pCExportReportANSIDetail);

                BL.V.CommitTransaction();
            }
            catch
            {
                BL.V.RollbackTransaction();
            }

            //上传附件
            if (!string.IsNullOrEmpty(pCExportReportANSIDetail.accessoriesList))
            {
                string sfdir = this.ServerSavePath + "\\" + pCExportReportANSIDetail.PCExportReportANSIDetailId;
                try
                {
                    System.IO.Directory.CreateDirectory(sfdir);     //创建上传目录
                }
                catch (Exception ex)
                { throw new Helper.MessageValueException(ex.Message); }
                foreach (string fn in pCExportReportANSIDetail.accessoriesList.Split('|'))
                {
                    System.IO.File.Copy(fn, sfdir + "\\" + fn.Substring(fn.LastIndexOf("\\") + 1), true);
                }
            }
        }
Example #8
0
        private void barBtnSearch_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            DetailsList f = new DetailsList(this._FromPC);

            if (f.ShowDialog(this) == DialogResult.OK)
            {
                Model.PCExportReportANSIDetail currentModel = f.SelectItem as Model.PCExportReportANSIDetail;
                if (currentModel != null)
                {
                    this._pcExpANSIDetail = currentModel;
                    this._pcExpANSIDetail = this._pcExpANSIDetailManager.Get(this._pcExpANSIDetail.PCExportReportANSIDetailId);
                    this.Refresh();
                }
            }
            f.Dispose();
            GC.Collect();
        }
 private void TiGuiExists(Model.PCExportReportANSIDetail model)
 {
     if (this.ExistsPrimary(model.PCExportReportANSIDetailId))
     {
         //设置KEY值
         string invoiceKind   = this.GetInvoiceKind().ToLower();
         string sequencekey_y = string.Format("{0}-y-{1}", invoiceKind, model.InsertTime.Value.Year);
         string sequencekey_m = string.Format("{0}-m-{1}-{2}", invoiceKind, model.InsertTime.Value.Year, model.InsertTime.Value.Month);
         string sequencekey_d = string.Format("{0}-d-{1}", invoiceKind, model.InsertTime.Value.ToString("yyyy-MM-dd"));
         string sequencekey   = string.Format(invoiceKind);
         SequenceManager.Increment(sequencekey_y);
         SequenceManager.Increment(sequencekey_m);
         SequenceManager.Increment(sequencekey_d);
         SequenceManager.Increment(sequencekey);
         model.PCExportReportANSIDetailId = this.GetId(model.InsertTime.Value);
         TiGuiExists(model);
     }
 }
Example #10
0
        protected override void Delete()
        {
            if (this._pcExpANSIDetail == null)
            {
                return;
            }
            if (MessageBox.Show(Properties.Resources.ConfirmToDelete, this.Text, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) != DialogResult.OK)
            {
                return;
            }

            //首先删除附件

            this._pcExpANSIDetailManager.Delete(this._pcExpANSIDetail.PCExportReportANSIDetailId);

            this._pcExpANSIDetail = this._pcExpANSIDetailManager.mGetNext(this._pcExpANSIDetail.InsertTime.Value, this._FromPC);
            if (this._pcExpANSIDetail == null)
            {
                this._pcExpANSIDetail = this._pcExpANSIDetailManager.mGetLast(this._FromPC);
            }
        }
Example #11
0
        public RODetail(string text, Model.PCExportReportANSIDetail detail, IList <Model.PCExportReportANSIDetail> list)
            : this()
        {
            this.lblCompanyName.Text = BL.Settings.CompanyChineseName;
            this.lblReportName.Text  = text + "†Î";
            this.lblPrintDate.Text  += DateTime.Now.ToString("yyyy-MM-dd");

            this.lblInvoiceCusXOId.Text = detail.InvoiceCusXOId;
            this.lblProduct.Text        = detail.Product == null ? null : detail.Product.ToString();
            this.lblCustomer.Text       = detail.Customer == null ? null : detail.Customer.ToString();

            this.DataSource = list;

            TCTestType.DataBindings.Add("Text", DataSource, Model.PCExportReportANSIDetail.PRO_Type);
            TCInvoiceId.DataBindings.Add("Text", DataSource, Model.PCExportReportANSIDetail.PRO_PCExportReportANSIDetailId);
            TCTestDate.DataBindings.Add("Text", DataSource, Model.PCExportReportANSIDetail.PRO_CheckDate, "{0:yyyy-MM-dd}");
            TCInvoiceNum.DataBindings.Add("Text", DataSource, Model.PCExportReportANSIDetail.PRO_InvoiceQuantity);
            TCTestNum.DataBindings.Add("Text", DataSource, Model.PCExportReportANSIDetail.PRO_MustCheckSum);
            TCGetNum.DataBindings.Add("Text", DataSource, Model.PCExportReportANSIDetail.PRO_HasCheckSum);
            TCPassNum.DataBindings.Add("Text", DataSource, Model.PCExportReportANSIDetail.PRO_PassSum);
            TCUnPassNum.DataBindings.Add("Text", DataSource, "UnPassSum");
        }
Example #12
0
 protected override void MoveFirst()
 {
     this._pcExpANSIDetail = this._pcExpANSIDetailManager.Get(this._pcExpANSIDetailManager.mGetFirst(this._FromPC) == null ? "" : this._pcExpANSIDetailManager.mGetFirst(this._FromPC).PCExportReportANSIDetailId);
 }
Example #13
0
 public Model.PCExportReportANSIDetail GetNext(Model.PCExportReportANSIDetail e)
 {
     return(accessor.GetNext(e));
 }
        public void Update(Model.PCExportReportANSIDetail pCExportReportANSIDetail)
        {
            if (pCExportReportANSIDetail != null)
            {
                Validate(pCExportReportANSIDetail);
                pCExportReportANSIDetail.UpdateTime = DateTime.Now;

                accessor.Update(pCExportReportANSIDetail);

                //上传修改文件
                string sfdir = this.ServerSavePath + "\\" + pCExportReportANSIDetail.PCExportReportANSIDetailId;
                if (!System.IO.Directory.Exists(sfdir))
                {
                    System.IO.Directory.CreateDirectory(sfdir);
                }

                string[] newfilenames = pCExportReportANSIDetail.accessoriesList.Split('|'); //上传而来
                string[] hasfilenames = System.IO.Directory.GetFiles(sfdir);                 //原本有的

                if (!string.IsNullOrEmpty(pCExportReportANSIDetail.accessoriesList))
                {
                    //--添加新附件
                    foreach (string newfile in newfilenames)
                    {
                        bool flag = true;
                        foreach (string hasfile in hasfilenames)
                        {
                            //if (hasfile.Equals(newfile.Substring(newfile.LastIndexOf("\\") + 1), StringComparison.OrdinalIgnoreCase))
                            if (hasfile.Equals(newfile, StringComparison.OrdinalIgnoreCase))
                            {
                                flag = false;
                                break;
                            }
                        }
                        if (flag)
                        {
                            System.IO.File.Copy(newfile, sfdir + "\\" + newfile.Substring(newfile.LastIndexOf("\\") + 1), true);
                        }
                    }
                }

                //删除旧附件
                foreach (string hasfile in hasfilenames)
                {
                    bool flag = true;
                    foreach (string newfile in newfilenames)
                    {
                        string IstrueName = newfile.Substring(newfile.LastIndexOf("\\") + 1);
                        if (IstrueName.Equals(hasfile.Substring(hasfile.LastIndexOf("\\") + 1), StringComparison.OrdinalIgnoreCase))
                        {
                            flag = false;
                            break;
                        }
                    }
                    if (flag)
                    {
                        System.IO.File.Delete(hasfile);
                    }
                }
            }
        }
 public Model.PCExportReportANSIDetail GetPrev(Model.PCExportReportANSIDetail e)
 {
     return(sqlmapper.QueryForObject <Model.PCExportReportANSIDetail>("PCExportReportANSIDetail.get_prev", e));
 }
 public bool HasRowsAfter(Model.PCExportReportANSIDetail e)
 {
     return(sqlmapper.QueryForObject <bool>("PCExportReportANSIDetail.has_rows_after", e));
 }
 public bool HasRowsBefore(Model.PCExportReportANSIDetail e)
 {
     return(sqlmapper.QueryForObject <bool>("PCExportReportANSIDetail.has_rows_before", e));
 }
 public void Update(Model.PCExportReportANSIDetail e)
 {
     this.Update <Model.PCExportReportANSIDetail>(e);
 }
Example #19
0
 public bool HasRowsAfter(Model.PCExportReportANSIDetail e)
 {
     return(accessor.HasRowsAfter(e));
 }
 public bool mHasRowsAfter(Model.PCExportReportANSIDetail e, string FromPC)
 {
     return(accessor.mHasRowsAfter(e, FromPC));
 }
 public void Delete(Model.PCExportReportANSIDetail pCExportReportANSIDetail)
 {
     this.Delete(pCExportReportANSIDetail.PCExportReportANSIDetailId);
 }
 public void Insert(Model.PCExportReportANSIDetail e)
 {
     this.Insert <Model.PCExportReportANSIDetail>(e);
 }
Example #23
0
 public bool HasRowsBefore(Model.PCExportReportANSIDetail e)
 {
     return(accessor.HasRowsBefore(e));
 }