コード例 #1
0
        public ActionResult Update(XttcbModel model)
        {
            if (Request.IsAjaxRequest())
            {
                if (string.IsNullOrEmpty(model.jcyy))
                {
                    model.jcyy = string.Empty;
                }
                if (string.IsNullOrEmpty(model.tclxbh))
                {
                    model.tclxbh = string.Empty;
                }
                if (string.IsNullOrEmpty(model.tctp))
                {
                    model.tctp = string.Empty;
                }
                _xttcbService.Update(model);
                return(Json(new { Code = 200, Msg = "修改成功." }));
            }
            int id = 0;

            int.TryParse(Request.Params["item"], out id);
            model = _xttcbService.GetSingleById(id);
            if (model == null)
            {
                return(Redirect("/"));
            }

            ViewBag.MealTable  = _xttcbService.GetMinMeal("DL201505201452130001");
            ViewBag.MealTable2 = _xttcbService.GetMinMeal("DL201505201452500001");
            return(View(model));
        }
コード例 #2
0
        public int Update(XttcbModel model)
        {
            string sqlString = "UPDATE xt_tcb SET jsj=@jsj,tcmc=@tcmc,jcyy=@jcyy,tcpx=@tcpx,jg=@jg,xb=@xb,hz=@hz,sfqy=@sfqy,tctp=@tctp,tclxbh=@tclxbh WHERE id=@id";

            using (IDbConnection dbConnection = new DapperConnection().DbConnection)
            {
                return(dbConnection.Execute(sqlString, model));
            }
        }
コード例 #3
0
 /// <summary>
 /// 获取企业套餐
 /// </summary>
 /// <returns></returns>
 public XttcbModel GetTc(string yybh, string tcbh)
 {
     using (IDbConnection conn = new DapperConnection().DbConnection)
     {
         string     sql   = "select id,tclxbh,jcyy,tcpx,tctp,tcbh,tcmc,dwbh,dwmc,jg,sfqy,createtime,dsfbzid,xb,hz,isnull(jsj,0) as jsj,updatetime,yybh,tclx,sxrs  from xt_tcb where yybh=@yybh  and tcbh=@tcbh";
         XttcbModel model = conn.Query <XttcbModel>(sql, new { yybh = yybh, tcbh = tcbh }).FirstOrDefault();
         return(model);
     }
 }
コード例 #4
0
        /// <summary>
        /// 获取套餐信息
        /// </summary>
        /// <returns></returns>
        public XttcbModel GetTcxx(string tcid)
        {
            using (IDbConnection conn = new DapperConnection().DbConnection)
            {
                DynamicParameters paramList = new DynamicParameters();

                string sqlAll = "SELECT * FROM xt_tcb WHERE SFQY=1 AND tcbh=@TCID and tclx=2 and dwbh='0000'";
                paramList.Add("TCID", tcid);
                XttcbModel model = conn.QueryFirstOrDefault <XttcbModel>(sqlAll, paramList);
                return(model);
            }
        }
コード例 #5
0
        /// <summary>
        /// 个人套餐同步南医三院
        /// </summary>
        /// <param name="jgModel"></param>
        /// <param name="dwbh"></param>
        /// <param name="msg"></param>
        /// <returns></returns>
        public static bool GrTcTb_nysy(XtJgbModel jgModel, int qdbh, ref string msg)
        {
            try
            {
                ReturnMessage Message = new ReturnMessage();
                //获取南医三院的套餐列表
                returnData TCModelList = GetClusInfo();
                if (TCModelList != null)
                {
                    //套餐
                    List <XttcbModel> TClList = new List <XttcbModel>();
                    //套餐下组合项目关联
                    List <XttczhxmbModel> TCGLlList = new List <XttczhxmbModel>();
                    //套餐下组合项目
                    List <XttczhxmbmxModel> TCZHXMlList = new List <XttczhxmbmxModel>();
                    foreach (_clusInfos itemTC in TCModelList.clusInfos)
                    {
                        XttcbModel TCModel = new XttcbModel();
                        TCModel.yybh       = jgModel.yybh;
                        TCModel.tcbh       = string.IsNullOrEmpty(itemTC.clus_code) ? "" : itemTC.clus_code.Trim();
                        TCModel.tcmc       = string.IsNullOrEmpty(itemTC.clus_name) ? "" : itemTC.clus_name.Trim();
                        TCModel.dwbh       = "0";
                        TCModel.dwmc       = "南医三院个人套餐";
                        TCModel.tclx       = 2;
                        TCModel.jg         = itemTC.price;
                        TCModel.sfqy       = 1;
                        TCModel.createtime = DateTime.Now;
                        TCModel.xb         = getNysySEX(itemTC.sex);
                        TCModel.dsfbzid    = qdbh;
                        TClList.Add(TCModel);
                        string  tcbh = TCModel.tcbh;
                        decimal OrderMaterialsFee = 0;
                        string  zhxmbhList        = "";
                        foreach (_itemInfos itemZHXM in itemTC.itemInfos)//组合项目
                        {
                            string zhxmbh = string.IsNullOrEmpty(itemZHXM.comb_code) ? "" : itemZHXM.comb_code.Trim();
                            zhxmbhList += zhxmbh + ";";

                            //去重
                            List <XttczhxmbmxModel> TCZHXMlCheck = TCZHXMlList.Where(p => p.zhxmbh == zhxmbh).ToList();
                            if (TCZHXMlCheck.Count == 0)
                            {
                                XttczhxmbmxModel TCZHXMModel = new XttczhxmbmxModel();
                                TCZHXMModel.createtime = DateTime.Now;
                                TCZHXMModel.sffk       = 0;
                                TCZHXMModel.sfqy       = 1;
                                TCZHXMModel.updatetime = DateTime.Now;
                                TCZHXMModel.xb         = getNysySEX(itemTC.sex);
                                TCZHXMModel.yybh       = jgModel.yybh;
                                TCZHXMModel.zhxmbh     = zhxmbh;
                                TCZHXMModel.zhxmjg     = itemZHXM.price;
                                //TCZHXMModel.zhxmksbh = "";
                                //TCZHXMModel.zhxmksmc = "";
                                TCZHXMModel.zhxmmc = itemZHXM.comb_name;
                                TCZHXMModel.zhxmms = itemZHXM.note;
                                TCZHXMlList.Add(TCZHXMModel);
                            }

                            //去重
                            List <XttczhxmbModel> TCGLCheck = TCGLlList.Where(p => p.zhxmbh == zhxmbh & p.tcbh == tcbh).ToList();
                            if (TCGLCheck.Count == 0)
                            {
                                XttczhxmbModel TCGLModel = new XttczhxmbModel();
                                TCGLModel.yybh       = jgModel.yybh;
                                TCGLModel.dwbh       = "0";
                                TCGLModel.zhxmbh     = zhxmbh;
                                TCGLModel.tcbh       = tcbh;
                                TCGLModel.createtime = DateTime.Now;
                                TCGLlList.Add(TCGLModel);
                            }

                            OrderMaterialsFee = 0;
                        }

                        if (!string.IsNullOrEmpty(zhxmbhList))//同步耗材信息
                        {
                            OrderMaterialsFee = GetOrderMaterialsFee(zhxmbhList, out Message);
                            if (Message.state != "200")
                            {
                                msg = Message.message;
                                return(false);
                            }

                            if (OrderMaterialsFee != 0)
                            {
                                XttczhxmbmxModel TCZHXMModel1 = new XttczhxmbmxModel();
                                TCZHXMModel1.createtime = DateTime.Now;
                                TCZHXMModel1.sffk       = 0;
                                TCZHXMModel1.sfqy       = 1;
                                TCZHXMModel1.updatetime = DateTime.Now;
                                TCZHXMModel1.xb         = getNysySEX(itemTC.sex);
                                TCZHXMModel1.yybh       = jgModel.yybh;
                                TCZHXMModel1.zhxmbh     = tcbh + "_HC";
                                TCZHXMModel1.zhxmjg     = OrderMaterialsFee.ToString();

                                TCZHXMModel1.zhxmmc = TCModel.tcmc + "_耗材费";
                                TCZHXMModel1.zhxmms = "耗材费";
                                TCZHXMlList.Add(TCZHXMModel1);
                            }
                            if (OrderMaterialsFee != 0)
                            {
                                XttczhxmbModel TCGLModel1 = new XttczhxmbModel();
                                TCGLModel1.yybh       = jgModel.yybh;
                                TCGLModel1.dwbh       = "0";
                                TCGLModel1.zhxmbh     = tcbh + "_HC";
                                TCGLModel1.tcbh       = tcbh;
                                TCGLModel1.createtime = DateTime.Now;
                                TCGLlList.Add(TCGLModel1);
                            }
                        }
                        TCModel.jg = TCModel.jg + OrderMaterialsFee;
                    }
                    new XttcbService().InsertOrUpdate(TClList, TCGLlList, TCZHXMlList);
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                msg = ex.Message;
                return(false);
            }
        }
コード例 #6
0
        /// <summary>
        /// 将excel中的数据导入到list中
        /// </summary>
        /// <param name="sheetName">excel工作薄sheet的名称</param>
        /// <param name="isFirstRowColumn">第一行是否是DataTable的列名</param>
        /// <returns>返回的DataTable</returns>
        public void ExcelToList(string fileName, string sheetName, int tclx, out string msg, ref List <XttcbModel> li, ref List <XttczhxmbModel> lizhxm)
        {
            ISheet    sheet    = null;
            IWorkbook workbook = null;
            int       startRow = 1;

            msg = string.Empty;
            try
            {
                FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read);
                if (fileName.IndexOf(".xlsx") > 0) // 2007版本
                {
                    workbook = new XSSFWorkbook(fs);
                }
                else if (fileName.IndexOf(".xls") > 0) // 2003版本
                {
                    workbook = new HSSFWorkbook(fs);
                }

                if (sheetName != null)
                {
                    sheet = workbook.GetSheet(sheetName);
                    if (sheet == null) //如果没有找到指定的sheetName对应的sheet,则尝试获取第一个sheet
                    {
                        sheet = workbook.GetSheetAt(0);
                    }
                }
                else
                {
                    sheet = workbook.GetSheetAt(0);
                }
                if (sheet != null)
                {
                    IRow firstRow  = sheet.GetRow(0);
                    int  cellCount = firstRow.LastCellNum; //一行最后一个cell的编号 即总的列数
                    int  col       = cellCount;            //总列数
                    if (!ValidateTemplate(firstRow, col))
                    {
                        msg = "模板错误,请下载并使用正确的模板";
                        return;
                    }

                    //最后一行的标号
                    int rowCount = sheet.LastRowNum;
                    for (int i = startRow; i <= rowCount; ++i)
                    {
                        IRow row = sheet.GetRow(i);
                        if (row == null)
                        {
                            continue;              //没有数据的行默认是null
                        }
                        XttcbModel tcModel = new XttcbModel();


                        tcModel.yybh = GLYadmin.YYID;
                        tcModel.tclx = tclx;
                        tcModel.tcbh = GetCellValue(row, 0).ToString().Trim();
                        if (string.IsNullOrWhiteSpace(tcModel.tcbh))
                        {
                            msg = $"第{i}行套餐编号不能为空";
                            return;
                        }
                        tcModel.tcmc = GetCellValue(row, 1).ToString().Trim();
                        if (string.IsNullOrWhiteSpace(tcModel.tcmc))
                        {
                            msg = $"第{i}行套餐名称不能为空";
                            return;
                        }
                        tcModel.dwbh = GetCellValue(row, 2).ToString().Trim();

                        if (string.IsNullOrWhiteSpace(tcModel.dwbh))
                        {
                            msg = $"第{i}行单位编号不能为空";
                            return;
                        }
                        tcModel.dsfbzid = int.Parse(tcModel.dwbh);
                        tcModel.dwmc    = GetCellValue(row, 3).ToString().Trim();
                        if (string.IsNullOrWhiteSpace(tcModel.dwmc))
                        {
                            msg = $"第{i}行单位名称不能为空";
                            return;
                        }
                        tcModel.jg = Convert.ToDecimal(GetCellValue(row, 4));
                        string sex = GetCellValue(row, 5).ToString();
                        switch (sex)
                        {
                        case "男":
                            tcModel.xb = 1;
                            break;

                        case "女":
                            tcModel.xb = 0;
                            break;

                        case "通用":
                            tcModel.xb = 2;
                            break;

                        default:
                            tcModel.xb = -1;
                            break;
                        }

                        if (tcModel.xb.Equals(-1))
                        {
                            msg = $"第{i}行性别不正确(仅支持:男,女,通用)";
                            return;
                        }
                        string sfqy = GetCellValue(row, 6).ToString();
                        switch (sfqy)
                        {
                        case "是":
                            tcModel.sfqy = 1;
                            break;

                        case "否":
                            tcModel.sfqy = 0;
                            break;

                        default:
                            tcModel.sfqy = -1;
                            break;
                        }
                        if (tcModel.sfqy.Equals(-1))
                        {
                            msg = $"第{i}行是否启用不正确(仅支持:是,否)";
                            return;
                        }
                        string hyzt = GetCellValue(row, 7).ToString();
                        switch (hyzt)
                        {
                        case "已婚":
                            tcModel.hz = 1;
                            break;

                        case "未婚":
                            tcModel.hz = 0;
                            break;

                        case "不限":
                            tcModel.hz = 2;
                            break;

                        default:
                            tcModel.hz = -1;
                            break;
                        }
                        if (tcModel.hz.Equals(-1))
                        {
                            msg = $"第{i}行婚姻状态不正确(仅支持:已婚,未婚,不限)";
                            return;
                        }
                        string zhxmbh = GetCellValue(row, 8).ToString().Trim();
                        if (!string.IsNullOrWhiteSpace(zhxmbh))
                        {
                            try
                            {
                                List <string> liZhxmbh = zhxmbh.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries).ToList();
                                foreach (var strZhxm in liZhxmbh)
                                {
                                    XttczhxmbModel tczhxmmodel = new XttczhxmbModel();
                                    tczhxmmodel.zhxmbh     = strZhxm.Trim();
                                    tczhxmmodel.yybh       = GLYadmin.YYID;
                                    tczhxmmodel.dwbh       = tcModel.dwbh;
                                    tczhxmmodel.tcbh       = tcModel.tcbh;
                                    tczhxmmodel.createtime = DateTime.Now;
                                    lizhxm.Add(tczhxmmodel);
                                }
                            }
                            catch (Exception e)
                            {
                                msg = $"第{i}行组合项目编号不正确(以逗号隔开)";
                                return;
                            }
                        }

                        li.Add(tcModel);
                    }
                }

                if (li.Count.Equals(0))
                {
                    msg = "模板不能为空";
                }
            }
            catch (Exception ex)
            {
                msg = "读取模板失败";
                Log.WriteLog(ex.Message);
            }
        }