示例#1
0
        /// <summary>
        /// 确定
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void OKButton_Click(object sender, EventArgs e)
        {
            using (ContractProvider contProvider = new ContractProvider())
            {
                var dateModel = LocalGlobal.GetDateModel();

                string aDate = LocalGlobal.ConvertDateFormat(ActualDate.Text.Trim()).ToString("yyyyMMdd");
                if (this.CurrentItem.Length == 0)
                {
                    //新增
                    if (contProvider.GetArprocessDetailItem(this.CurrentID, cboItem.SelectedValue.Trim(), Seq.Text.Trim()) == null) //不存在
                    {
                        try
                        {
                            contProvider.InsertArprocessDetail(Seq.Text.Trim(), CurrentID, cboItem.SelectedValue.Trim(), SAmt.Text.Trim(), Per.Text.Trim(), aDate, ActualAmt.Text.Trim(), cboType.SelectedValue.Trim(), Remark.Text.Trim(), LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr);
                        }
                        catch (Exception error)
                        {
                            this.ShowErrorMessage(this.GetGlobalResourceString("CreateErrorMessage") + error.Message);
                            return;
                        }
                    }
                    else
                    {
                        this.ShowWarningMessage(this.GetGlobalResourceString("ExistedErrorMessage"));
                        return;
                    }
                }
                else
                {
                    //编辑
                    try
                    {
                        contProvider.UpdateArprocessDetail(CurrentID, CurrentItem, CurrentSeq, aDate, ActualAmt.Text.Trim(), cboType.SelectedValue.Trim(), Remark.Text.Trim(), LocalGlobal.CurrentUserID, dateModel.DateStr, dateModel.TimeStr);
                    }
                    catch (Exception error)
                    {
                        this.ShowErrorMessage(this.GetGlobalResourceString("UpdateErrorMessage") + error.Message);
                        return;
                    }
                }
            }
            //回调
            this.DialogCallback("'CloseRefresh'", "window");
        }
示例#2
0
 /// <summary>
 /// 绑定项目
 /// </summary>
 private void BindItem()
 {
     using (ContractProvider contProvider = new ContractProvider())
     {
         var row = contProvider.GetArprocessDetailItem(this.CurrentID, this.CurrentItem, this.CurrentSeq);
         if (row != null)
         {
             cboItem.SelectedValue = row["lflag"].ToString().Trim();
             Seq.Text              = row["lseq"].ToString();
             Per.Text              = row["lper"].ToString();
             SAmt.Text             = row["lsamt"].ToString();
             ActualAmt.Text        = row["lramt"].ToString();
             ActualDate.Text       = row["lrdte"].ToString().Trim().Substring(0, row["lrdte"].ToString().Trim().IndexOf("."));
             cboType.SelectedValue = row["ltype"].ToString().Trim();
             Remark.Text           = row["lnote"].ToString();
         }
     }
 }