示例#1
0
        public List <Model.ObjSub> objsublist = null; //结果值
        protected override void SetPowerZone()
        {
            int id = Convert.ToInt32(Request.QueryString["xxid"]);

            uid.Value = id.ToString();
            objuser   = BLL.ObjUser.GetModel(id);
            obj       = BLL.OObject.GetModel(objuser.ObjID);
            oapply    = BLL.ObjUserApply.GetModelOID(objuser.BaoMingOID);
            listChild = BLL.ObjChild.GetModelList(" ID IN(" + oapply.SubID + ") ");
            listExcel = BLL.ObjExcel.GetModelList(" ObjOID='" + obj.ObjOID + "' ");


            objsample = BLL.ObjSample.GetModelOID(objuser.YangPinOID);
            obj       = BLL.OObject.GetModel(oapply.ObjID);
            tmember   = BLL.Member.GetModelByMID(oapply.MID);


            objsubuser = BLL.ObjSubUser.GetModelList(" SpInt=" + obj.ID + " AND MID='" + tmember.MID + "'").FirstOrDefault();
            if (objsubuser != null)
            {
                string[] sublist = objsubuser.Spare.Split(',');
                string   substr  = "";
                foreach (var item in sublist)
                {
                    if (string.IsNullOrEmpty(item))
                    {
                        continue;
                    }
                    substr += "'" + item + "',";
                }

                objsublist = BLL.ObjSub.GetModelList(" OID in(" + substr.Substring(0, substr.Length - 1) + ") ");
            }
        }
        protected override string btnAdd_Click()
        {
            Model.ObjUser    ouser    = BLL.ObjUser.GetModel(Convert.ToInt32(Request.Form["uid"]));
            Model.ObjSubUser Osubuser = BLL.ObjSubUser.GetModel(Convert.ToInt32(Request.Form["osuid"]));

            Hashtable MyHs = new Hashtable();

            if (ouser.RState != 1)
            {
                return("状态已更新,请刷新");
            }
            ouser.RState       = 3;
            ouser.USState      = 3;
            ouser.RDate        = DateTime.Now;
            ouser.ZhengShuCode = Guid.NewGuid().ToString("D");
            BLL.ObjUser.Update(ouser);

            Osubuser.SState = 3;
            BLL.ObjSubUser.Update(Osubuser, MyHs);

            Model.ObjUserApply oua = BLL.ObjUserApply.GetModelOID(ouser.BaoMingOID);
            oua.YZState = 1;
            BLL.ObjUserApply.Update(oua, MyHs);


            if (BLL.CommonBase.RunHashtable(MyHs))
            {
                BLL.OperationRecordBLL.Add(TModel.MID, "验证结果审核成功", "项目名称为:" + ouser.ObjName + ",结果提交人为:" + ouser.MID);
                return("审核成功");
            }
            else
            {
                return("审核失败");
            }
        }
        protected override string btnModify_Click()
        {
            Model.ObjUser    ouser    = BLL.ObjUser.GetModel(Convert.ToInt32(Request.Form["uid"]));
            Model.ObjSubUser Osubuser = BLL.ObjSubUser.GetModel(Convert.ToInt32(Request.Form["osuid"]));

            Hashtable MyHs = new Hashtable();

            if (ouser.RState != 1)
            {
                return("状态已更新,请刷新");
            }
            ouser.RState  = 0;
            ouser.RImgUrl = "";
            BLL.ObjUser.Update(ouser, MyHs);


            BLL.ObjSubUser.Delete(Osubuser.ID, MyHs);

            string[] sublist = Osubuser.Spare.Split(',');
            string   substr  = "";

            foreach (var item in sublist)
            {
                if (string.IsNullOrEmpty(item))
                {
                    continue;
                }
                substr += "'" + item + "',";
            }
            MyHs.Add("DELETE OBJSUB WHERE OID IN(" + substr.Substring(0, substr.Length - 1) + ");select " + Guid.NewGuid().ToString("N"), null);
            if (BLL.CommonBase.RunHashtable(MyHs))
            {
                BLL.OperationRecordBLL.Add(TModel.MID, "验证结果审核打回", "项目名称为:" + ouser.ObjName + ",结果提交人为:" + ouser.MID);
                return("返回成功,可重新上传结果");
            }
            else
            {
                return("审核失败");
            }
        }
        protected override void SetPowerZone()
        {
            int pid = Convert.ToInt32(Request.QueryString["xxid"]);

            OUSER     = BLL.ObjUser.GetModel(pid);
            uid.Value = pid.ToString();         // ObjUser ID
            oid.Value = OUSER.ObjID.ToString(); //OObject ID
            obj       = BLL.OObject.GetModel(OUSER.ObjID);

            Model.ObjUserApply oA = BLL.ObjUserApply.GetModelOID(OUSER.BaoMingOID);
            listExcel = BLL.ObjExcel.GetModelList(" ObjOID='" + obj.ObjOID + "' ");

            OSU           = BLL.ObjSubUser.GetModelList(" MID='" + OUSER.MID + "' AND SpInt=" + obj.ID + " and SState!=3 ").FirstOrDefault();
            osuid.Value   = OSU.ID.ToString();
            FangFa.Value  = OSU.RFangFa;
            YiQi.Value    = OSU.RSheBei;
            YiChang.Value = OSU.RYiChang;

            string[] sublist = OSU.Spare.Split(',');
            string   substr  = "";

            foreach (var item in sublist)
            {
                if (string.IsNullOrEmpty(item))
                {
                    continue;
                }
                substr += "'" + item + "',";
            }

            listChild = BLL.ObjSub.GetModelList(" OID in(" + substr.Substring(0, substr.Length - 1) + ") ");
            Random rd = new Random();
            int    cc = rd.Next(1000, 9999);

            rdstr = cc.ToString();
        }
        protected override string btnAdd_Click()
        {
            Hashtable MyHs = new Hashtable();

            Model.ObjUser OU = BLL.ObjUser.GetModel(Convert.ToInt32(Request.Form["uid"]));

            Model.OObject objxx = BLL.OObject.GetModel(OU.ObjID);

            if (Convert.ToInt32(BLL.CommonBase.GetSingle("select COUNT(*) from ObjSubUser where mid='" + TModel.MID + "' AND SpInt='" + OU.ObjID + "' and SState!=3 and sstate!=0;")) > 0)
            {
                return("您已提交过结果,请等待审核");
            }

            OU.RState      = 1;
            OU.RImgUrl     = Request.Form["uploadurl"];
            OU.RUpLoadDate = DateTime.Now;
            BLL.ObjUser.Update(OU, MyHs);

            Model.ObjUserApply    oA         = BLL.ObjUserApply.GetModelOID(OU.BaoMingOID);
            List <Model.ObjChild> listChild2 = BLL.ObjChild.GetModelList(" ID in(" + oA.SubID + ") ");
            string suboid = "";

            foreach (var item in listChild2)
            {
                string childone = Request.Form["ChildOne" + item.ID.ToString()];
                string childtwo = Request.Form["ChildTwo" + item.ID.ToString()];
                string childavg = Request.Form["ChildAvg" + item.ID.ToString()];

                if (string.IsNullOrEmpty(childone) || string.IsNullOrEmpty(childtwo) || string.IsNullOrEmpty(childavg))
                {
                    return("请填入结果值");
                }
                Model.ObjSub OSub = new Model.ObjSub();
                OSub.MID       = TModel.MID;
                OSub.OID       = Guid.NewGuid().ToString("N");
                OSub.ResultOne = childone;
                OSub.ResultTwo = childtwo;
                OSub.ResultAvg = childavg;
                OSub.Spare     = item.ChildName;
                OSub.CID       = item.ID;
                OSub.ObjID     = objxx.ID;
                OSub.ObjOID    = objxx.ObjOID;
                OSub.URID      = OU.ID;
                OSub.SpInt     = oA.ID;
                BLL.ObjSub.Add(OSub, MyHs);
                suboid += OSub.OID + ",";
            }

            //如果已有提交结果就修改,未提交过就生成
            Model.ObjSubUser reOBJSUB = BLL.ObjSubUser.GetModelList(" mid='" + TModel.MID + "' AND SpInt='" + OU.ObjID + "' and sstate=0;").FirstOrDefault();
            if (reOBJSUB == null)
            {
                Model.ObjSubUser objapply = new Model.ObjSubUser();
                objapply.MID          = TModel.MID;
                objapply.RFangFa      = Request.Form["FangFa"];
                objapply.RSheBei      = Request.Form["YiQi"];
                objapply.RYiChang     = Request.Form["YiChang"];
                objapply.ResultImgUrl = Request.Form["uploadurl"];
                objapply.SpInt        = Convert.ToInt32(Request.Form["oid"]);
                objapply.MID          = TModel.MID;
                objapply.SState       = 0;
                objapply.Spare        = suboid.Substring(0, suboid.Length - 1);
                BLL.ObjSubUser.Add(objapply, MyHs);
            }
            else
            {
                reOBJSUB.MID          = TModel.MID;
                reOBJSUB.RFangFa      = Request.Form["FangFa"];
                reOBJSUB.RSheBei      = Request.Form["YiQi"];
                reOBJSUB.RYiChang     = Request.Form["YiChang"];
                reOBJSUB.ResultImgUrl = Request.Form["uploadurl"];
                reOBJSUB.SpInt        = Convert.ToInt32(Request.Form["oid"]);
                reOBJSUB.MID          = TModel.MID;
                reOBJSUB.SState       = 0;
                reOBJSUB.Spare        = suboid.Substring(0, suboid.Length - 1);
                BLL.ObjSubUser.Update(reOBJSUB, MyHs);
            }


            if (BLL.CommonBase.RunHashtable(MyHs))
            {
                BLL.OperationRecordBLL.Add(TModel.MID, "结果提交", "项目名称为:" + objxx.ObjName);
                return("结果提交成功,请等待审核");
            }
            else
            {
                return("提交失败");
            }
        }