Exemplo n.º 1
0
        /// <summary>
        /// save操作
        /// </summary>
        /// <param name="OPer"></param>
        protected void OperSave(string OPer)
        {
            CY.CSTS.Core.Business.SurveyTable surTable = getSbNow();
            if (surTable == null)
            {
                surTable = new CY.CSTS.Core.Business.SurveyTable();
            }
            CY.CSTS.Core.Business.User u = (CY.CSTS.Core.Business.User)Session["User"];

            try
            {
                Guid MacId = new Guid(hdId.Value);
                surTable.MACHINESETID = MacId;

                int QuarterTime = 0;
                if (int.TryParse(tbUseTime.Value, out QuarterTime))
                {
                    surTable.QuarterTime = QuarterTime;
                }

                int SampleNum = 0;
                if (int.TryParse(tbSampleNum.Value, out QuarterTime))
                {
                    surTable.SampleNum = SampleNum;
                }

                int ServiceTime = 0;
                if (int.TryParse(tbTotleUseTime.Value, out ServiceTime))
                {
                    surTable.ServiceTime = ServiceTime;
                }
                if (OPer == "Insert")//点击保存
                {
                    surTable.Status = 1;//保存状态
                }

                else if (OPer == "submission")//点击提交
                {
                    surTable.Status = 2;//提交状态
                }

                else if (OPer == "SubModi")//提交修改
                {
                    surTable.Status = 3;//未评审
                }
                surTable.SurveyID = new Guid(hdSurveyID.Value);
                surTable.TEL = tbTel.Value;

                if (u.UserType == 1)//普通用户
                {
                    surTable.Type = 1;//机组
                }
                else if (u.UserType == 4)
                {
                    surTable.Type = 0;//单位
                }

                surTable.UnitID = CY.CSTS.Core.Business.MACHINESET.Load(MacId).UnitID;

                surTable.ApplicaiotnUser = u.Id;

                DateTime dt = DateTime.Now;
                if (DateTime.TryParse(tbAppTime.InnerText, out dt))
                {
                    surTable.ApplicationTime = DateTime.Parse(tbAppTime.InnerText);
                }

                if (RdNor.Checked)
                {
                    surTable.CollectionStatus = 1;
                }
                else
                    surTable.CollectionStatus = 2;

                int enterpriseCount = 0;
                if (int.TryParse(tbEnterpriseCount.Value, out enterpriseCount))
                {
                    surTable.EnterpriseCount = enterpriseCount;
                }

                int externalItemCount = 0;
                if (int.TryParse(tbExternalItemCount.Value, out externalItemCount))
                {
                    surTable.ExternalItemCount = externalItemCount;
                }

                int ExternalTime = 0;
                if (int.TryParse(tbExternalTime.Value, out ExternalTime))
                {
                    surTable.ExternalTime = ExternalTime;
                }

                int ExternaSampleNum = 0;
                if (int.TryParse(tbExternaSampleNum.Value, out ExternaSampleNum))
                {
                    surTable.ExternaSampleNum = ExternaSampleNum;
                }

                if (RdBackY.Checked)
                {
                    surTable.Feedback = 1;
                }
                else
                    surTable.Feedback = 2;

                surTable.FeedbackTime = tbFeedback.Value;
                surTable.GroupMember = tbMem.Value;
                surTable.GroupName = lbName.InnerText;

                if (lbGather.Text.Trim() == "是")
                {
                    surTable.HasCollection = 1;
                }
                else
                    surTable.HasCollection = 2;

                double income = 0;
                if (double.TryParse(tbIncome.Value, out income))
                {
                    surTable.Income = income;
                }

                int ItemCount = 0;
                if (int.TryParse(tbItemCount.Value, out ItemCount))
                {
                    surTable.ItemCount = ItemCount;
                }

                surTable.Save();
                BindGv(surTable.SurveyID);
                string sqlwhere = "where [surveyID]='" + surTable.SurveyID + "' and [MACHINESETID]='" + surTable.MACHINESETID + "'";
                CY.CSTS.Core.Business.SurveyTable sb = CY.CSTS.Core.Business.SurveyTable.SelectBySurNMac(sqlwhere);
                SaveFiles(sb.Id);

            }
            catch (Exception ex)
            {

            }
        }
Exemplo n.º 2
0
 protected CY.CSTS.Core.Business.SurveyTable getSbNow()
 {
     CY.CSTS.Core.Business.SurveyTable sb = new CY.CSTS.Core.Business.SurveyTable();
     try
     {
         Guid macId = new Guid(hdId.Value);
         Guid surId = new Guid(hdSurveyID.Value);
         string sqlwhere = " where [surveyID]='" + surId + "' and [MACHINESETID]='" + macId + "'";
         sb = CY.CSTS.Core.Business.SurveyTable.SelectBySurNMac(sqlwhere);
     }
     catch (Exception ex)
     {
         sb = null;
     }
     return sb;
 }