Ejemplo n.º 1
0
        protected void BindData(Guid ID)
        {
            CY.CSTS.Core.Business.CommissionedApplication application = CY.CSTS.Core.Business.CommissionedApplication.Load(ID);

            if (application != null)
            {
                lbCommissionUnit.Text = application.CommissionedUint;
                lbUnit.Text = application.UnitName;
                lbInstrument.Text = application.InstrumentName;
                lbAddress.Text = application.Address;
                lbPostCode.Text = application.Zip;
                lbPersonName.Text = application.PersonName;
                lbPhone.Text = application.Phone;
                lbProjectName.Text = application.ProjectName;
                lbFax.Text = application.Fax;
                lbContractNo.Text = application.ProjectContractNo;
                lbProjectLeader.Text = application.ProjectLeader;
                lbProjectType.Text = application.ProjectTypeName;
                lbContent.Text = application.ContenAndRequirements;
                lbState.Text = GetState(application.Status);
                lbDes.Text = application.AdmissibilityDes;
                lbFeedback.Text = GetFeedback(application.Feedback);
                lbAdvise.Text = application.Advice;
                lbApplyTime.Text = application.ApplicateTime.ToShortDateString();
                lbAdviceTime.Text = application.AdviceFillTime.ToShortDateString();

                string whereCondition = " [ApplicationID]='" + application.Id + "'";
                List<CY.CSTS.Core.Business.CommissionedCompletionRecord> recordlist = CY.CSTS.Core.Business.CommissionedCompletionRecord.SelectCommissionedCompletionRecordByDynamic(whereCondition, "");

                if (recordlist != null && recordlist.Count != 0)
                {
                    record = recordlist[0];
                }

                if (record != null)
                {
                    lbFillPerson.Text = record.FillPersonName;
                    lbAchieveTime.Text = record.AchieveTime.ToShortDateString();
                    lbSamplesNub.Text = record.SamplesNub.ToString();
                    lbMachineTime.Text = record.MachineTime.ToString();
                    lbCharges.Text = record.Charges;
                    lbFeesReceivable.Text = record.FeesReceivable;
                    lbActualCharges.Text = record.ActualCharges;
                    lbUnits.Text = record.MachinesetName;
                    lbFillTime.Text = record.FillTime.ToShortDateString();
                }
            }
        }
Ejemplo n.º 2
0
        protected void btnSaveRecord_Click(object sender, EventArgs e)
        {
            CY.CSTS.Core.Business.User U = (CY.CSTS.Core.Business.User)Session["User"];
            if (U != null)
            {
                try
                {
                    Guid comAppId = new Guid(hdMacId.Value);
                    CY.CSTS.Core.Business.CommissionedApplication comapp = CY.CSTS.Core.Business.CommissionedApplication.Load(comAppId);
                    CY.CSTS.Core.Business.CommissionedCompletionRecord comRecord = new CY.CSTS.Core.Business.CommissionedCompletionRecord();
                    comRecord.ApplicationID = comAppId;
                    comRecord.FillPerson = U.Id;

                    DateTime achtime = new DateTime();
                    if (DateTime.TryParse(tbAchieveTime.Value, out achtime))
                    {
                        comRecord.AchieveTime = achtime;
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('完成时间格式错误!');</script>");
                        return;
                    }

                    double samNum = new double();
                    if (double.TryParse(tbSamplesNub.Value, out samNum))
                    {
                        comRecord.SamplesNub = samNum;
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('完成样品数格式错误!');</script>");
                        return;
                    }

                    double macTime = new double();
                    if (double.TryParse(tbMachineTime.Value, out macTime))
                    {
                        comRecord.MachineTime = macTime;
                    }
                    else
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('使用机时数格式错误!');</script>");
                        return;
                    }

                    if (string.IsNullOrEmpty(tbCharges.Value))
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('收费标准不能为空');</script>");
                        return;
                    }

                    if (string.IsNullOrEmpty(tbFeesReceivable.Value))
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('应收费用不能为空');</script>");
                        return;
                    }

                    if (string.IsNullOrEmpty(tbActualCharges.Value))
                    {
                        Page.ClientScript.RegisterClientScriptBlock(this.GetType(), "", "<script type='text/javascript'>alert('实际收费不能为空');</script>");
                        return;
                    }

                    comRecord.Charges = tbCharges.Value;
                    comRecord.FeesReceivable = tbFeesReceivable.Value;
                    comRecord.ActualCharges = tbActualCharges.Value;
                    Guid insId = comapp.InstrumentID;
                    comRecord.Units = CY.CSTS.Core.Business.view_INSTRUMENT.Load(insId).MachineGroupId;
                    comRecord.FillTime = System.DateTime.Now;
                    comRecord.Save();
                    comapp.Status = 6;//完成

                    sendEmail("complete");

                    comapp.Save();
                    bindgvAdmiss();
                }
                catch (Exception ex)
                {
                    lbErr.Text = "保存失败";
                }
            }
            else
            {
                lbErr.Text = "请登录";
            }
        }