Exemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Uaptitude"></param>
        /// <returns></returns>
        public ActionResult InsertUserAptitude(UserAptitude Uaptitude)
        {
            Acc_Account account = GAccount.GetAccountInfo();

            Uaptitude.StrCreateUser = account.UserID.ToString();
            Uaptitude.StrCreateTime = DateTime.Now;
            Uaptitude.StrValidate   = "v";
            Uaptitude.StrUnit       = account.UnitID;
            HttpPostedFileBase file = Request.Files[0];

            byte[] fileByte = new byte[0];
            if (file.FileName != "")
            {
                Uaptitude.StrFileName = file.FileName.Substring(file.FileName.LastIndexOf('\\') + 1);
                int fileLength = file.ContentLength;
                if (fileLength != 0)
                {
                    fileByte = new byte[fileLength];
                    file.InputStream.Read(fileByte, 0, fileLength);
                }
            }
            string strErr = "";

            if (UserAptitudeMan.InsertNewUserAptitude(Uaptitude, fileByte, ref strErr) == true)
            {
                ViewData["msg"] = "保存成功";
                return(View("AddAptitude", Uaptitude));
            }
            else
            {
                ViewData["msg"] = "保存失败";
                return(View("AddAptitude", Uaptitude));
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult AptitudeUserGrid()
        {
            Acc_Account account = GAccount.GetAccountInfo();

            string where = " and a.Unit = '" + account.UnitID + "'";
            string strCurPage;
            string strRowNum;
            string UserName = Request["userName"].ToString();

            if (Request["curpage"] != null)
            {
                strCurPage = Request["curpage"].ToString();
            }
            if (Request["rownum"] != null)
            {
                strRowNum = Request["rownum"].ToString();
            }
            else
            {
                strRowNum = "10";
            }
            if (UserName != "")
            {
                where += " and b.UserName like '%" + UserName + "%'";
            }
            UIDataTable udtTask = UserAptitudeMan.getNewAptitudeUserGrid(GFun.SafeToInt32(strRowNum), GFun.SafeToInt32(Request["curpage"]) - 1, where);
            string      strjson = GFun.Dt2Json("", udtTask.DtData);

            strjson = strjson.Substring(1);
            strjson = strjson.Substring(0, strjson.Length - 1);
            string jsonData = "{ \"page\":" + GFun.SafeToInt32(Request["curpage"]) + ", \"total\": " + udtTask.IntTotalPages + ", \"records\": " + udtTask.IntRecords + ", \"rows\": ";

            jsonData += strjson + "}";
            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Uaptitude"></param>
        /// <returns></returns>
        public ActionResult UpDataUserAptitude(UserAptitude Uaptitude)
        {
            var                ID      = Request["ID"];
            Acc_Account        account = GAccount.GetAccountInfo();
            HttpPostedFileBase file    = Request.Files[0];

            byte[] fileByte = new byte[0];
            if (file.FileName != "")
            {
                Uaptitude.StrFileName = file.FileName.Substring(file.FileName.LastIndexOf('\\') + 1);
                int fileLength = file.ContentLength;
                if (fileLength != 0)
                {
                    fileByte = new byte[fileLength];
                    file.InputStream.Read(fileByte, 0, fileLength);
                }
            }
            string strErr = "";

            if (UserAptitudeMan.UpdateNewUserAptitude(ID, Uaptitude, fileByte, ref strErr) == true)
            {
                ViewData["ID"]  = ID;
                ViewData["msg"] = "保存成功";
                return(View("UpdateAptitude", Uaptitude));
            }
            else
            {
                ViewData["msg"] = "保存失败";
                return(View("UpdateAptitude", Uaptitude));
            }
        }
Exemplo n.º 4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Bas"></param>
 /// <returns></returns>
 public ActionResult InsertContractBas(ContractBas Bas)
 {
     if (ModelState.IsValid)
     {
         Acc_Account account = GAccount.GetAccountInfo();
         Bas.StrUnit       = account.UnitID.ToString();
         Bas.StrCID        = ContractMan.GetNewCID();
         Bas.StrCreateTime = DateTime.Now;
         Bas.StrCreateUser = account.UserID.ToString();
         Bas.StrValidate   = "v";
         string strErr = "";
         if (ContractMan.InsertNewContractBas(Bas, ref strErr) == true)
         {
             return(Json(new { success = "true", Msg = "保存成功" }));
         }
         else
         {
             return(Json(new { success = "false", Msg = "保存出错" + "/" + strErr }));
         }
     }
     else
     {
         //如果有错误,继续输入信息
         return(Json(new { success = "false", Msg = "数据验证不通过" }));
     }
 }
Exemplo n.º 5
0
        public ActionResult SelectProduct()
        {
            var         ProductName = Request["data1"];
            Acc_Account account     = GAccount.GetAccountInfo();
            string      UnitID      = account.UnitID;
            DataTable   dt          = COM_ApprovalMan.getNewProductByName(ProductName, UnitID);
            string      name        = "";
            string      spc         = "";
            string      pid         = "";
            string      units       = "";

            string unitprice = "";
            string price2    = "";

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                name  += dt.Rows[i]["ProName"] + "$";
                spc   += dt.Rows[i]["Spec"] + "$";
                pid   += dt.Rows[i]["PID"] + "$";
                units += dt.Rows[i]["Units"] + "$";

                unitprice += dt.Rows[i]["UnitPrice"] + "$";
                price2    += dt.Rows[i]["Price2"] + "$";
            }
            name = name.TrimEnd('$');
            //spc = spc.TrimEnd('$');
            spc   = spc.Remove(spc.LastIndexOf("$"), 1);
            pid   = pid.TrimEnd('$');
            units = units.TrimEnd('$');

            unitprice = unitprice.TrimEnd('$');
            price2    = price2.TrimEnd('$');
            return(Json(new { success = "true", Strname = name, Strspc = spc, Stpid = pid, strunits = units, Strunitprice = unitprice, Strprice2 = price2 }));
        }
Exemplo n.º 6
0
        public ActionResult InsertContractFile()
        {
            //获取上传的文件
            HttpFileCollection Filedata = System.Web.HttpContext.Current.Request.Files;

            // 如果没有上传文件
            if (Filedata == null || Filedata.Count == 0 || Filedata[0].ContentLength == 0)
            {
                return(this.HttpNotFound());
            }
            else
            {
                ContractBas Bas = new ContractBas();
                Bas.StrCID        = Request["PID"].ToString();
                Bas.StrCreateTime = DateTime.Now;
                Acc_Account account = GAccount.GetAccountInfo();
                Bas.StrCreateUser = account.UserID.ToString();
                Bas.StrValidate   = "v";
                string strErr = "";
                if (ProjectMan.InsertNewContratFile(Bas, Filedata, ref strErr) == true)
                {
                    return(Json(new { success = "true", Msg = "保存成功" }));
                }
                else
                {
                    return(Json(new { success = "false", Msg = "保存出错" + "/" + strErr }));
                }
            }
        }
Exemplo n.º 7
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult StandingBookGrid()
        {
            Acc_Account account = GAccount.GetAccountInfo();
            string      unit    = account.UnitID.ToString();

            string where = " and a.UnitID = '" + unit + "'";
            string strCurPage;
            string strRowNum;
            string TracingType  = Request["TracingType"].ToString();
            string CheckCompany = Request["CheckCompany"].ToString();
            string StarTime     = Request["starTime"].ToString();
            string EndTime      = Request["endTime"].ToString();
            string OrderDate    = "";

            if (Request["curpage"] != null)
            {
                strCurPage = Request["curpage"].ToString();
            }
            if (Request["rownum"] != null)
            {
                strRowNum = Request["rownum"].ToString();
            }
            else
            {
                strRowNum = "10";
            }
            if (TracingType != "")
            {
                where += " and b.CheckWay = '" + TracingType + "'";
            }
            if (CheckCompany != "")
            {
                where += " and a.CheckCompany like '%" + CheckCompany + "%'";
            }
            if (StarTime != "")
            {
                where += " and b.CheckDate >= '" + StarTime + "' and b.CheckDate <= '" + EndTime + "' ";
            }
            string Order = " order by m.ControlCode";

            if (Request["OrderDate"] != null)
            {
                OrderDate = Request["OrderDate"].ToString();
            }
            if (OrderDate != "")
            {
                string[] arrLast = OrderDate.Split('@');
                Order = " order by m." + arrLast[0] + " " + arrLast[1] + "";
            }
            UIDataTable udtTask = EquipMan.getNewStandingBookGrid(GFun.SafeToInt32(strRowNum), GFun.SafeToInt32(Request["curpage"]) - 1, where, Order);
            string      strjson = GFun.Dt2Json("", udtTask.DtData);

            strjson = strjson.Substring(1);
            strjson = strjson.Substring(0, strjson.Length - 1);
            string jsonData = "{ \"page\":" + GFun.SafeToInt32(Request["curpage"]) + ", \"total\": " + udtTask.IntTotalPages + ", \"records\": " + udtTask.IntRecords + ", \"rows\": ";

            jsonData += strjson + "}";
            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 8
0
        public ActionResult SelectModule()
        {
            Acc_Account account = GAccount.GetAccountInfo();

            ViewData["Role"]   = account.UserRole;
            ViewData["UserID"] = account.UserID.ToString();
            return(View());
        }
Exemplo n.º 9
0
 /// <summary>
 /// 可以
 /// </summary>
 /// <returns></returns>
 public ActionResult ContractGrid(tk_ContractSearch ContractSearch)
 {
     if (ModelState.IsValid)
     {
         string where = "";
         Acc_Account account = GAccount.GetAccountInfo();
         string      unit    = account.UnitID.ToString();
         if (unit == "32" || unit == "46")
         {
             where += "";
         }
         else
         {
             where += " and a.Unit = '" + unit + "'";
         }
         if (account.UserRole == "3")
         {
             where += " and a.BusinessType = 'BT5'";
         }
         string strCurPage;
         string strRowNum;
         string Cname      = ContractSearch.Cname;
         string ContractID = ContractSearch.ContractID;
         if (Request["curpage"] != null)
         {
             strCurPage = Request["curpage"].ToString();
         }
         if (Request["rownum"] != null)
         {
             strRowNum = Request["rownum"].ToString();
         }
         else
         {
             strRowNum = "10";
         }
         if (Cname != "" && Cname != null)
         {
             where += " and a.Cname like '%" + Cname + "%'";
         }
         if (ContractID != "" && ContractID != null)
         {
             where += " and a.ContractID like '%" + ContractID + "%'";
         }
         UIDataTable udtTask = ContractMan.getNewContractGrid(GFun.SafeToInt32(strRowNum), GFun.SafeToInt32(Request["curpage"]) - 1, where);
         string      strjson = GFun.Dt2Json("", udtTask.DtData);
         strjson = strjson.Substring(1);
         strjson = strjson.Substring(0, strjson.Length - 1);
         string jsonData = "{ \"page\":" + GFun.SafeToInt32(Request["curpage"]) + ", \"total\": " + udtTask.IntTotalPages + ", \"records\": " + udtTask.IntRecords + ", \"rows\": ";
         jsonData += strjson + "}";
         return(Json(jsonData, JsonRequestBehavior.AllowGet));
     }
     else
     {
         //如果有错误,继续输入信息
         return(Json(new { success = false, Msg = "查询条件验证不通过" }));
     }
 }
Exemplo n.º 10
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public ActionResult StayReturnCashGrid(tk_ContractSearch ContractSearch)
 {
     if (ModelState.IsValid)
     {
         Acc_Account account = GAccount.GetAccountInfo();
         string      unit    = account.UnitID.ToString();
         string where = "";
         string time = ContractMan.getNewReturnTime();
         if (time == "")
         {
             where = " and a.Unit = '" + unit + "' and a.state != '2' and DATEDIFF(MONTH,GETDATE(),a.CPlanEndTime) <= '2'";
         }
         else
         {
             where = " and a.Unit = '" + unit + "' and a.state != '2' and DATEDIFF(MONTH,GETDATE(),a.CPlanEndTime) <= '" + time + "'";
         }
         string strCurPage;
         string strRowNum;
         //string PayOrIncome = Request["payOrIncome"].ToString();
         string Cname      = ContractSearch.Cname;
         string ContractID = ContractSearch.ContractID;
         if (Request["curpage"] != null)
         {
             strCurPage = Request["curpage"].ToString();
         }
         if (Request["rownum"] != null)
         {
             strRowNum = Request["rownum"].ToString();
         }
         else
         {
             strRowNum = "10";
         }
         //if (PayOrIncome != "")
         //    where += " and a.PayOrIncome = '" + PayOrIncome + "'";
         if (Cname != "" && Cname != null)
         {
             where += " and a.Cname like '%" + Cname + "%'";
         }
         if (ContractID != "" && ContractID != null)
         {
             where += " and a.ContractID = '" + ContractID + "'";
         }
         UIDataTable udtTask = ContractMan.getNewContractGrid(GFun.SafeToInt32(strRowNum), GFun.SafeToInt32(Request["curpage"]) - 1, where);
         string      strjson = GFun.Dt2Json("", udtTask.DtData);
         strjson = strjson.Substring(1);
         strjson = strjson.Substring(0, strjson.Length - 1);
         string jsonData = "{ \"page\":" + GFun.SafeToInt32(Request["curpage"]) + ", \"total\": " + udtTask.IntTotalPages + ", \"records\": " + udtTask.IntRecords + ", \"rows\": ";
         jsonData += strjson + "}";
         return(Json(jsonData, JsonRequestBehavior.AllowGet));
     }
     else
     {
         //如果有错误,继续输入信息
         return(Json(new { success = false, Msg = "查询条件验证不通过" }));
     }
 }
Exemplo n.º 11
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult AptitudeWarnGrid()
        {
            string where = "";
            Acc_Account account = GAccount.GetAccountInfo();

            where = " and a.Unit = '" + account.UnitID + "'";
            string num = UserAptitudeMan.getNewAptitudeTime();

            if (num == "")
            {
                where += " and DATEDIFF(MONTH,GETDATE(),a.CertificatDate) <= '2'";
            }
            else
            {
                where += "  and DATEDIFF(MONTH,GETDATE(),a.CertificatDate) <= '" + num + "'";
            }
            string strCurPage;
            string strRowNum;
            string UserName     = Request["userName"].ToString();
            string BusinessType = Request["businessType"].ToString();
            string TecoName     = Request["tecoName"].ToString();

            if (Request["curpage"] != null)
            {
                strCurPage = Request["curpage"].ToString();
            }
            if (Request["rownum"] != null)
            {
                strRowNum = Request["rownum"].ToString();
            }
            else
            {
                strRowNum = "10";
            }
            if (UserName != "")
            {
                where += " and a.UserName like '%" + UserName + "%'";
            }
            if (BusinessType != "")
            {
                where += " and a.BusinessType = '" + BusinessType + "'";
            }
            if (TecoName != "")
            {
                where += " and a.TecoName like '%" + TecoName + "%'";
            }
            UIDataTable udtTask = UserAptitudeMan.getNewAptitudeGrid(GFun.SafeToInt32(strRowNum), GFun.SafeToInt32(Request["curpage"]) - 1, where, account.UnitID);
            string      strjson = GFun.Dt2Json("", udtTask.DtData);

            strjson = strjson.Substring(1);
            strjson = strjson.Substring(0, strjson.Length - 1);
            string jsonData = "{ \"page\":" + GFun.SafeToInt32(Request["curpage"]) + ", \"total\": " + udtTask.IntTotalPages + ", \"records\": " + udtTask.IntRecords + ", \"rows\": ";

            jsonData += strjson + "}";
            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 12
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult TracingGrid()
        {
            Acc_Account account = GAccount.GetAccountInfo();
            string      unit    = account.UnitID.ToString();

            string where = " and a.UnitID = '" + unit + "'";
            string strCurPage;
            string strRowNum;
            string XStarTime = Request["xstarTime"].ToString();
            string XEndTime  = Request["xendTime"].ToString();
            string JStarTime = Request["JStarTime"].ToString();
            string JEndTime  = Request["JEndTime"].ToString();
            string OrderDate = "";

            if (Request["curpage"] != null)
            {
                strCurPage = Request["curpage"].ToString();
            }
            if (Request["rownum"] != null)
            {
                strRowNum = Request["rownum"].ToString();
            }
            else
            {
                strRowNum = "10";
            }
            if (XStarTime != "")
            {
                where += " and a.LastDate >= '" + XStarTime + "' and a.LastDate <= '" + XEndTime + "' ";
            }
            if (JStarTime != "")
            {
                where += " and a.PlanDate >= '" + JStarTime + "' and a.PlanDate <= '" + JEndTime + "' ";
            }
            string Order = " order by m.ControlCode";

            if (Request["OrderDate"] != null)
            {
                OrderDate = Request["OrderDate"].ToString();
            }
            if (OrderDate != "")
            {
                string[] arrLast = OrderDate.Split('@');
                Order = " order by m." + arrLast[0] + " " + arrLast[1] + "";
            }

            UIDataTable udtTask = EquipMan.getNewTracingGrid(GFun.SafeToInt32(strRowNum), GFun.SafeToInt32(Request["curpage"]) - 1, where, Order);
            string      strjson = GFun.Dt2Json("", udtTask.DtData);

            strjson = strjson.Substring(1);
            strjson = strjson.Substring(0, strjson.Length - 1);
            string jsonData = "{ \"page\":" + GFun.SafeToInt32(Request["curpage"]) + ", \"total\": " + udtTask.IntTotalPages + ", \"records\": " + udtTask.IntRecords + ", \"rows\": ";

            jsonData += strjson + "}";
            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 13
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult EquipWarnGrid()
        {
            Acc_Account account = GAccount.GetAccountInfo();
            string      unit    = account.UnitID.ToString();

            string where = " and a.state != '-1' and a.UnitID = '" + unit + "'";
            string ck1 = EquipMan.getNewCK1time();

            if (ck1 != "")
            {
                where += " and (DATEDIFF(MONTH,GETDATE(),a.PlanDate)) <= '" + ck1 + "'";
            }
            else
            {
                where += " and (DATEDIFF(MONTH,GETDATE(),a.PlanDate)) <= '2'";
            }

            string strCurPage;
            string strRowNum;
            string OrderDate = "";

            if (Request["curpage"] != null)
            {
                strCurPage = Request["curpage"].ToString();
            }
            if (Request["rownum"] != null)
            {
                strRowNum = Request["rownum"].ToString();
            }
            else
            {
                strRowNum = "10";
            }
            string Order = " order by m.ControlCode";

            if (Request["OrderDate"] != null)
            {
                OrderDate = Request["OrderDate"].ToString();
            }
            if (OrderDate != "")
            {
                string[] arrLast = OrderDate.Split('@');
                Order = " order by m." + arrLast[0] + " " + arrLast[1] + "";
            }
            UIDataTable udtTask = EquipMan.getNewEquipGrid(GFun.SafeToInt32(strRowNum), GFun.SafeToInt32(Request["curpage"]) - 1, where, Order, unit);
            string      strjson = GFun.Dt2Json("", udtTask.DtData);

            strjson = strjson.Substring(1);
            strjson = strjson.Substring(0, strjson.Length - 1);
            string jsonData = "{ \"page\":" + GFun.SafeToInt32(Request["curpage"]) + ", \"total\": " + udtTask.IntTotalPages + ", \"records\": " + udtTask.IntRecords + ", \"rows\": ";

            jsonData += strjson + "}";
            return(Json(jsonData, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 14
0
        // 审批流程控制审批按钮可用不可用
        public ActionResult JudgeAppDisable()
        {
            var         webkey     = Request["data1"];
            var         SPID       = Request["data2"];
            Acc_Account account    = GAccount.GetAccountInfo();
            string      logUser    = account.UserID.ToString();
            string      folderBack = COM_ApprovalMan.getNewwebkey(webkey);
            int         bol        = COM_ApprovalMan.JudgeNewLoginUser(logUser, webkey, folderBack, SPID);

            return(Json(new { success = "true", intblo = bol }));
        }
Exemplo n.º 15
0
        /// <summary>
        ///
        /// </summary>
        /// <returns></returns>
        public ActionResult ToExcelStanding()
        {
            Acc_Account account  = GAccount.GetAccountInfo();
            string      unit     = account.UnitID.ToString();
            string      UnitName = account.UnitName;

            string where = " and a.UnitID = '" + unit + "'";
            string TracingType  = Request["TracingType"].ToString();
            string CheckCompany = Request["CheckCompany"].ToString();
            string StarTime     = Request["starTime"].ToString();
            string EndTime      = Request["endTime"].ToString();
            string Order        = Request["Order"].ToString();
            string whereOrder   = "";

            if (TracingType != "")
            {
                where += " and b.CheckWay = '" + TracingType + "'";
            }
            if (CheckCompany != "")
            {
                where += " and a.CheckCompany like '%" + CheckCompany + "%'";
            }
            if (StarTime != "")
            {
                where += " and b.CheckDate >= '" + StarTime + "' and b.CheckDate <= '" + EndTime + "' ";
            }
            if (Order == "")
            {
                whereOrder = " order by m.ControlCode";
            }
            else
            {
                string[] arrLast = Order.Split('@');
                whereOrder = " order by m." + arrLast[0] + " " + arrLast[1] + "";
            }
            DataTable data = EquipMan.getNewPrintStanding(where, whereOrder);

            if (data != null)
            {
                string strCols = "序号-2000,控制编号-5000,名称-5000,生产厂家-7000,检定单位-7000,出厂编号-7000,规格型号-5000,精度-5000,以检日期-5000,周期-3000,方式-3000,费用-3000";
                data.Columns["xu"].SetOrdinal(0);
                System.IO.MemoryStream stream = ExcelHelper.ExportDataTableToExcel(data, UnitName + "-仪器设备一览表", strCols.Split(','));
                stream.Seek(0, System.IO.SeekOrigin.Begin);
                return(File(stream, "application/vnd.ms-excel", "Info.xls"));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 16
0
        public ActionResult ValidateJudge()
        {
            Acc_Account account  = GAccount.GetAccountInfo();
            string      UserId   = account.UserID.ToString();
            string      validate = MainMan.judgeNewValidate(UserId);

            if (validate != "")
            {
                return(Json(new { success = "true", Msg = validate }));
            }
            else
            {
                return(Json(new { success = "false" }));
            }
        }
Exemplo n.º 17
0
        public ActionResult ToExcel()
        {
            Acc_Account account  = GAccount.GetAccountInfo();
            string      unit     = account.UnitID.ToString();
            string      unitName = account.UnitName;

            string where = " and a.Unit = '" + unit + "'";
            string strCurPage;
            string strRowNum;
            string Cname      = Request["cname"].ToString();
            string ContractID = Request["contractID"].ToString();
            string year       = DateTime.Now.ToString("yyyy");

            if (Request["curpage"] != null)
            {
                strCurPage = Request["curpage"].ToString();
            }
            if (Request["rownum"] != null)
            {
                strRowNum = Request["rownum"].ToString();
            }
            else
            {
                strRowNum = "10";
            }
            if (Cname != "")
            {
                where += " and a.Cname like '%" + Cname + "%'";
            }
            if (ContractID != "")
            {
                where += " and a.ContractID like '%" + ContractID + "%'";
            }
            DataTable data = ContractMan.getNewPrintStandingBook(where);

            if (data != null)
            {
                string strCols = "序号-2000,合同编号-5000,合同名称-5000,内容-5000,签署日期-5000,甲方单位-7000,乙方单位-7000,合同金额-5000,页数-5000,经办人-5000,备注-7000";
                data.Columns["xu"].SetOrdinal(0);
                System.IO.MemoryStream stream = ExcelHelper.ExportDataTableToExcel(data, year + "年" + unitName + "合同管理台账", strCols.Split(','));
                stream.Seek(0, System.IO.SeekOrigin.Begin);
                return(File(stream, "application/vnd.ms-excel", "Info.xls"));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 18
0
        //这里的方法需要验证登录状态,以下雷同
        public ActionResult Main(string id)
        {
            //var Url = Request["Url"];
            //ViewData["Url"] = Url;
            ViewData["Role"] = id;
            Acc_Account account = GAccount.GetAccountInfo();

            //ViewData["Role"] = account.UserRole;
            ViewData["UserName"] = account.UserName;
            ViewData["Unit"]     = account.UnitName;
            //领导审批提示
            ViewData["UserId"]    = account.UserID;
            ViewData["ExJob"]     = account.Exjob;
            ViewData["RoleNames"] = account.RoleNames;
            return(View());
        }
Exemplo n.º 19
0
        public FileResult ToTracingExcel()
        {
            Acc_Account account  = GAccount.GetAccountInfo();
            string      unit     = account.UnitID.ToString();
            string      UnitName = account.UnitName;

            string where = " and a.UnitID = '" + unit + "'";
            string XStarTime  = Request["xstarTime"].ToString();
            string XEndTime   = Request["xendTime"].ToString();
            string JStarTime  = Request["JStarTime"].ToString();
            string JEndTime   = Request["JEndTime"].ToString();
            string Order      = Request["Order"].ToString();
            string whereOrder = "";
            string year       = DateTime.Now.ToString("yyyy");

            if (XStarTime != "")
            {
                where += " and a.LastDate >= '" + XStarTime + "' and a.LastDate <= '" + XEndTime + "' ";
            }
            if (JStarTime != "")
            {
                where += " and a.PlanDate >= '" + JStarTime + "' and a.PlanDate <= '" + JEndTime + "' ";
            }
            if (Order == "")
            {
                whereOrder = " order by m.ControlCode";
            }
            else
            {
                string[] arrLast = Order.Split('@');
                whereOrder = " order by m." + arrLast[0] + " " + arrLast[1] + "";
            }
            DataTable data = EquipMan.getNewPintTracing(where, whereOrder);

            if (data != null)
            {
                string strCols = "序号-2000,设备名称-5000,控制编号-5000,规格型号-7000,制造商-7000,校准服务机构-10000,校准周期-5000,上次校准时间-5000,计划校准时间-5000,结果-3000,负责人-3000";
                data.Columns["xu"].SetOrdinal(0);
                System.IO.MemoryStream stream = ExcelHelper.ExportDataTableToExcel(data, year + "年度仪器设备溯源计划表", strCols.Split(','));
                stream.Seek(0, System.IO.SeekOrigin.Begin);
                return(File(stream, "application/vnd.ms-excel", "Info.xls"));
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 20
0
        public ActionResult SavePwd()
        {
            string      OldPwd  = Request["OldPwd"].ToString();
            string      NewPwd  = Request["NewPwd"].ToString();
            Acc_Account account = GAccount.GetAccountInfo();
            int         UserId  = account.UserID;
            string      err     = "";

            if (MainMan.UpdatePwd(OldPwd, NewPwd, UserId, ref err))
            {
                return(Json(new { success = "true", Msg = err }));
            }
            else
            {
                return(Json(new { success = "false", Msg = err }));
            }
        }
Exemplo n.º 21
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Scrap"></param>
        /// <returns></returns>
        public ActionResult InsertDScrapInfo(DScrapInfo Scrap)
        {
            Acc_Account account = GAccount.GetAccountInfo();

            Scrap.StrCreateUser = account.UserID.ToString();
            Scrap.StrCreateTime = DateTime.Now;
            string strErr = "";

            if (EquipMan.InsertNewDScrapInfo(Scrap, ref strErr) == true)
            {
                return(Json(new { success = "true", Msg = "保存成功" }));
            }
            else
            {
                return(Json(new { success = "false", Msg = "保存出错" + "/" + strErr }));
            }
        }
Exemplo n.º 22
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="num"></param>
        /// <returns></returns>
        public ActionResult InsertConfigTime(string num)
        {
            string      checkWay = "CK";
            string      TimeType = "Device";
            Acc_Account account  = GAccount.GetAccountInfo();
            string      unit     = account.UnitID.ToString();
            string      strErr   = "";

            if (EquipMan.InsertNewCongTime(checkWay, num, unit, TimeType, ref strErr) == true)
            {
                return(Json(new { success = "true", Msg = "保存成功" }));
            }
            else
            {
                return(Json(new { success = "false", Msg = "保存出错" + "/" + strErr }));
            }
        }
Exemplo n.º 23
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Lend"></param>
        /// <returns></returns>
        public ActionResult InsertLendAptitude(UCertificatLend Lend)
        {
            Acc_Account account = GAccount.GetAccountInfo();

            Lend.StrCreateUser = account.UserID.ToString();
            Lend.StrCreateTime = DateTime.Now;
            Lend.StrValidate   = "v";
            string strErr = "";

            if (UserAptitudeMan.InsertNewLendAptitude(Lend, ref strErr) == true)
            {
                return(Json(new { success = "true", Msg = "保存成功" }));
            }
            else
            {
                return(Json(new { success = "false", Msg = "保存失败" + "/" + strErr }));
            }
        }
Exemplo n.º 24
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Rsource"></param>
        /// <returns></returns>
        public ActionResult InsertRativeSource(RativeSource Rsource)
        {
            Acc_Account account = GAccount.GetAccountInfo();

            Rsource.StrCreateUser = account.UserID.ToString();
            Rsource.StrCreateTime = DateTime.Now;
            Rsource.StrValidate   = "v";
            string strErr = "";

            if (EquipMan.InsertNewRativeSource(Rsource, ref strErr) == true)
            {
                return(Json(new { success = "true", Msg = "保存成功" }));
            }
            else
            {
                return(Json(new { success = "false", Msg = "保存出错" + "/" + strErr }));
            }
        }
Exemplo n.º 25
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="Bas"></param>
        /// <returns></returns>
        public ActionResult InsertDeviceBas(DevicsBas Bas)
        {
            Acc_Account account = GAccount.GetAccountInfo();

            Bas.StrUnitID     = account.UnitID;
            Bas.StrCreateTime = DateTime.Now;
            Bas.StrCreateUser = account.UserID.ToString();
            Bas.StrValidate   = "v";
            Bas.StrIsCycle    = 1;
            string strErr = "";

            if (EquipMan.InsertNewDeviceBas(Bas, ref strErr) == true)
            {
                return(Json(new { success = "true", Msg = "保存成功" }));
            }
            else
            {
                return(Json(new { success = "false", Msg = "保存出错" + "/" + strErr }));
            }
        }
Exemplo n.º 26
0
        public ActionResult getProduct()
        {
            Acc_Account account = GAccount.GetAccountInfo();
            string      UnitID  = account.UnitID;
            DataTable   dt      = COM_ApprovalMan.getNewProductByUnitID(UnitID);

            if (dt == null || dt.Rows.Count == 0)
            {
                return(Json(new { success = "false", Msg = "无数据" }));
            }
            //string id = "";
            string name = "";

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                //id += dt.Rows[i]["PID"].ToString() + ",";
                name += dt.Rows[i]["ProName"].ToString() + ",";
            }
            //id = id.TrimEnd(',');
            name = name.TrimEnd(',');
            return(Json(new { success = "true", Strname = name }));
        }
Exemplo n.º 27
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="CST"></param>
 /// <returns></returns>
 public ActionResult InsertSettlement(CSettlement CST)
 {
     if (ModelState.IsValid)
     {
         Acc_Account account = GAccount.GetAccountInfo();
         CST.StrCreateUser = account.UserID.ToString();
         CST.StrCreateTime = DateTime.Now;
         string strErr = "";
         if (ContractMan.InsertNewSettlement(CST, ref strErr) == true)
         {
             return(Json(new { success = "true", Msg = "保存成功" }));
         }
         else
         {
             return(Json(new { success = "false", Msg = "保存出错" + "/" + strErr }));
         }
     }
     else
     {
         //如果有错误,继续输入信息
         return(Json(new { success = "false", Msg = "数据验证不通过" }));
     }
 }
Exemplo n.º 28
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="Cash"></param>
 /// <returns></returns>
 public ActionResult InsertCCashBack(CCashBack Cash)
 {
     if (ModelState.IsValid)
     {
         Cash.StrCreateTime = DateTime.Now;
         Acc_Account account = GAccount.GetAccountInfo();
         Cash.StrCreateUser = account.UserID.ToString();
         Cash.StrValidate   = "v";
         string strErr = "";
         if (ContractMan.InsertNewCCashBack(Cash, ref strErr) == true)
         {
             return(Json(new { success = "true", Msg = "保存成功" }));
         }
         else
         {
             return(Json(new { success = "false", Msg = "保存出错" + "/" + strErr }));
         }
     }
     else
     {
         //如果有错误,继续输入信息
         return(Json(new { success = "false", Msg = "数据验证不通过" }));
     }
 }
Exemplo n.º 29
0
        public ActionResult SignJudge()
        {
            Acc_Account account = GAccount.GetAccountInfo();
            string      unitid  = account.UnitID;

            #region MyRegion
            //string where = " and a.state != '-1' and a.UnitID = '" + unitid + "'";
            //string ck1 = EquipMan.getNewCK1time();
            //if (ck1 != "")
            //    where += " and (DATEDIFF(MONTH,GETDATE(),a.PlanDate)) <= '" + ck1 + "'";
            //else
            //    where += " and (DATEDIFF(MONTH,GETDATE(),a.PlanDate)) <= '2'";

            //string where1 = "";
            //string time = ContractMan.getNewReturnTime();
            //if (time == "")
            //    where1 = " and a.Unit = '" + unitid + "' and a.state != '2' and DATEDIFF(MONTH,GETDATE(),a.CPlanEndTime) <= '2'";
            //else
            //    where1 = " and a.Unit = '" + unitid + "' and a.state != '2' and DATEDIFF(MONTH,GETDATE(),a.CPlanEndTime) <= '" + time + "'";

            #endregion
            //资质到期
            string where2 = " and b.state!='-1' and b.DeclareUnitID = '" + unitid + "' ";
            //string num = UserAptitudeMan.getNewAptitudeTime();//1,1,2
            string num = SupplyManage.getZZTimeOut();
            if (num == "")
            {
                where2 += " and DATEDIFF(MONTH,GETDATE(),a.FTimeOut) <= '2'";
            }
            else
            {
                where2 += "  and DATEDIFF(MONTH,GETDATE(),a.FTimeOut) <= '" + num + "'";
            }
            //证书到期
            string where4 = " and b.state!='-1' and b.DeclareUnitID = '" + unitid + "'";
            string ck     = SupplyManage.getZSTimeOut();
            if (ck == "")
            {
                where4 += " and DATEDIFF(MONTH,GETDATE(),a.TimeOut) <= '2'";
            }
            else
            {
                where4 += "  and DATEDIFF(MONTH,GETDATE(),a.TimeOut) <= '" + num + "'";
            }
            #region 过期代码
            //string where3 = "";
            //if (unitid == "27")
            //    where3 += " and Recipient ='" + account.UserName + "'";
            //else
            //    where3 += " and 1<>1";
            #endregion

            string warn = MainMan.getNewJudgeWarnString(where2, where4);
            if (warn != "")
            {
                return(Json(new { success = "true", Msg = warn }));
            }
            else
            {
                return(Json(new { success = "false" }));
            }
        }
Exemplo n.º 30
0
        public ActionResult Login(Acc_Login model, string returnUrl, string customSelectForm)
        {
            if (ModelState.IsValid)
            {
                if (model.Password != null)
                {
                    if (model.Password.Length >= 0)
                    {
                        if (Account.ValidateUserPWD(model.UserName, model.Password))
                        {
                            Acc_Account iAccount = Account.ValidateUser(model.UserName, model.Password);

                            if (iAccount != null)
                            {
                                FormsAuthentication.SetAuthCookie(model.UserName, model.RememberMe);
                                //GAccountInfo uGa = GAccount.GetAccountInfo(model.UserName, customSelectForm);
                                HttpContextBase httpContext = new HttpContextWrapper(System.Web.HttpContext.Current);
                                //设置Session
                                httpContext.Session[GAccount.KEY_CACHEUSER] = iAccount;
                                //DALogWarnMan.AddLog("用户登录", strUserName, strUnitName);
                                if (Url.IsLocalUrl(returnUrl) && returnUrl.Length > 1 && returnUrl.StartsWith("/") &&
                                    !returnUrl.StartsWith("//") && !returnUrl.StartsWith("/\\"))
                                {
                                    return(Redirect(returnUrl));
                                }
                                else
                                {
                                    //string Path = iAccount.Path;
                                    //if (Path.IndexOf(".31.") >= 0)
                                    //{
                                    return(RedirectToAction("SelectModuleYS", "Main"));
                                    //}
                                    //if (Path.IndexOf(".49.") >= 0)
                                    //{
                                    //    return RedirectToAction("SelectModuleFZ", "Main");
                                    //}
                                    //return RedirectToAction("SelectModule", "Main");
                                }
                            }
                            return(null);
                        }
                        else
                        {
                            ModelState.AddModelError("err", "用户名或密码输入错误");
                            return(View(model));
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("", "登录失败,密码应至少8位");
                        return(View(model));
                    }
                }
                else
                {
                    ModelState.AddModelError("", "登录异常...");
                    return(View(model));
                }
            }
            else
            {
                ModelState.AddModelError("", "登录异常...");
                return(View(model));
            }
        }