Exemplo n.º 1
0
        public static int UpdateTalentInfoBasic(HttpRequest req, ref string message)
        {
            string tmp = Common.Constants.getReqValue(req, "CB_No");
            Model.TB_CG_CityBase model = cbdb.GetModel(Convert.ToInt32(tmp));


            if (req.Files[0].ContentLength != 0)
            {
                System.Drawing.Image image = null;
                System.Drawing.Image hb = null;
                System.Drawing.Graphics g = null;
                try
                {
                    var tmpext = Common.Constants.GetFileExt(req.Files[0].FileName);
                    //req.Files[0].SaveAs(req.MapPath("../newImages") + "\\" + tparfs.TP_TeamImag);
                    string filedir = req.MapPath("newImages") + "\\";
                    string filename = tmp + "." + tmpext;
                    req.Files[0].SaveAs(filedir + filename);
                    image = System.Drawing.Image.FromFile(filedir + filename, false);
                    //System.Drawing.Image newimage = image.GetThumbnailImage(700, 400, null, new IntPtr());
                    double dVal = image.Width / 139.00;
                    hb = new System.Drawing.Bitmap(139, (int)(image.Height / dVal));//创建图片对象
                    g = System.Drawing.Graphics.FromImage(hb);//创建画板并加载空白图像
                    g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;//设置保真模式为高度保真
                    g.DrawImage(image, new Rectangle(0, 0, 139, (int)(image.Height / dVal)), 0, 0, image.Width, image.Height, GraphicsUnit.Pixel);//开始画图
                    //2013-10-15注释
                    //model.CB_Img = "sl." + filename;
                    //hb.Save(filedir + "\\" + model.CB_Img);
                }
                finally
                {
                    image.Dispose();
                    g.Dispose();
                    hb.Dispose();
                }
            }

            model.CB_X = Common.Constants.getReqValue(req, "CB_X");
            model.CB_Y = Common.Constants.getReqValue(req, "CB_Y");
            model.CB_Name = Common.Constants.getReqValue(req, "CB_Name");
            model.cb_shopnum = Common.Constants.getReqValue(req, "CB_Num");
            //tmp = Common.Constants.getReqValue(req, "CB_Num");
            //if (tmp != "") model.CB_Num = int.Parse(tmp);
            model.CB_Num = Common.Constants.getReqValue(req, "CB_Position");
            model.cb_setup = Common.Constants.getReqValue(req, "CB_SetUp");
            model.CB_Des = Common.Constants.getReqValue(req, "CB_Des");
            model.CB_Je = Common.Constants.getReqValue(req, "CB_Je");
 
            cbcrdb.Delete(model.CB_No);//删除原有的记录
            var arrstr = Common.Constants.getReqValue(req, "TC_No");
            string[] arr;
            if (arrstr != "")
            {
                arr = arrstr.Split(',');
                foreach (var cr in arr)
                {
                    if (cr.Trim() != "")
                    {
                        var tmpModel = new Model.TB_CG_SocialWelfareLink() { CT_CB_No = model.CB_No, CT_TC_No = Convert.ToInt32(cr) };
                        if (!cbcrdb.Exists(tmpModel))
                        {
                            cbcrdb.Add(tmpModel);
                        }
                    }
                }
            }

            cbdb.Update(model);

            message = "更新公司成功";
            return Common.Constants.OK;
        }
Exemplo n.º 2
0
        /*更新特殊福利*/
        public static int UpdateTalentInfo3(HttpRequest req, ref string message, ref int id)
        {
            string tmp = Common.Constants.getReqValue(req, "CB_No");
            if (tmp == "")
            {
                message = "获取id失败,请重新选择更新";
                return Common.Constants.ERR;
            }
            Model.TB_CG_CityBase model = cbdb.GetModel(Convert.ToInt32(tmp));
            if (model == null)
            {
                message = "数据库不存在该记录,请刷新地图";
                return Common.Constants.ERR;
            }
            id = model.CB_No;

            model.CB_No = int.Parse(Common.Constants.getReqValue(req, "CB_No"));
             
            message = "更新特殊福利";

            cbcrdb.Delete(model.CB_No);//删除原有的记录
            var arrstr = Common.Constants.getReqValue(req, "WT_No");
            string TSFL = ""; 
            string[] arr;
            if (arrstr != "")
            {
                arr = arrstr.Split(',');
                foreach (var cr in arr)
                {
                    if (cr.Trim() != "")
                    {
                        var tmpModel = new Model.TB_CG_SocialWelfareLink() { CT_CB_No = model.CB_No, CT_TC_No = Convert.ToInt32(cr) };
                        if (!cbcrdb.Exists(tmpModel))
                        {
                            cbcrdb.Add(tmpModel);
                            if (TSFL != "")
                            {
                                cbcrdb.Add2(tmpModel);
                                
                            }
                            else
                            {
                                cbcrdb.Add1(tmpModel);
                                TSFL = "11";
                            }
                            
                        }
                    }
                }
            }
            
            return Common.Constants.OK;

        }