예제 #1
0
        public ActionResult btnCreate_Click()
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (Panda_CustomerDal.Exist(" and Name='" + Request["tbxName"] + "'").Rows.Count == 0)
                    {
                        string    guid    = Guid.NewGuid().ToString();
                        Hashtable hasData = new Hashtable();
                        hasData["Name"]           = Request["tbxName"];
                        hasData["FContactName"]   = Request["tbxContactName"];
                        hasData["FContactPhone"]  = Request["tbxContactPhone"];
                        hasData["FBGAddress"]     = Request["tbxAddress"];
                        hasData["FAddress"]       = Request["tbSelectedAddress"];
                        hasData["FCompanyNumber"] = Request["ddlCompany"];
                        hasData["CustomerType"]   = Request["ddlType"];
                        hasData["CustomerLevel"]  = Request["ddlGrade"];
                        hasData["MessageCount"]   = Request["tbxMsgNumber"];
                        hasData["FLngLat"]        = Request["tbxLngLat"];
                        hasData["Guid"]           = Guid.NewGuid().ToString();
                        hasData["FIsDelete"]      = 0;
                        hasData["FCreateUser"]    = GetIdentityName();
                        hasData["FCreateDate"]    = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ssss"));
                        hasData["FMapTempID"]     = guid;
                        Panda_CustomerDal.Insert(hasData);

                        Hashtable has1 = new Hashtable();
                        Hashtable has2 = new Hashtable();
                        has1["id"]           = guid;
                        has1["FMapTempName"] = Request["tbxName"];
                        has2["FMapTempID"]   = guid;
                        int maxid = Convert.ToInt32(Dal.DBUtil.SelectDataTable("select isnull(max(ID),0) as maxId from Map_TempProperty").Rows[0]["maxId"].ToString()) + 1;
                        has2["FAliasName"] = "Template" + maxid.ToString();
                        has2["FCenter"]    = Request["tbxLngLat"];
                        Bll.Map_TemplateBll.InsertTemplate(has1);
                        Bll.Map_TemplateBll.InsertTempProperty(has2);

                        ShowNotify("添加成功!");
                        // 关闭本窗体(触发窗体的关闭事件)
                        PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                    }
                    else
                    {
                        ShowNotify("客户名重复,请更换!");
                    }
                }
                catch
                {
                    ShowNotify("添加失败!");
                }
            }

            return(UIHelper.Result());
        }
예제 #2
0
        public ActionResult btnEdit_Click([Bind(Include = "ID,Name,FContactName,FContactPhone,FBGAddress,FAddress,FCompanyNumber,CustomerType,CustomerLevel,MessageCount,FLngLat")] Panda_Customer cus)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    if (Panda_CustomerDal.Exist(" and Name='" + Request["tbxName"] + "' and Name<>'" + Request["tbxOldName"] + "'").Rows.Count == 0)
                    {
                        Hashtable hasData = new Hashtable();
                        hasData["ID"]             = Request["tbxID"];
                        hasData["Name"]           = Request["tbxName"];
                        hasData["FContactName"]   = Request["tbxContactName"];
                        hasData["FContactPhone"]  = Request["tbxContactPhone"];
                        hasData["FBGAddress"]     = Request["tbxAddress"];
                        hasData["FAddress"]       = Request["tbSelectedAddress"];
                        hasData["FCompanyNumber"] = Request["ddlCompany"];
                        hasData["CustomerType"]   = Request["ddlType"];
                        hasData["CustomerLevel"]  = Request["ddlGrade"];
                        hasData["MessageCount"]   = Request["tbxMsgNumber"];
                        hasData["FLngLat"]        = Request["tbxLngLat"];
                        hasData["FUpdUser"]       = GetIdentityName();
                        hasData["FUpdDate"]       = Convert.ToDateTime(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ssss"));
                        Panda_CustomerDal.Update(hasData);

                        if (Request["tbxFMapTempID"].ToString() != "")
                        {
                            Hashtable has1 = new Hashtable();
                            has1["id"]           = Request["tbxFMapTempID"];
                            has1["FMapTempName"] = Request["tbxName"];
                            Bll.Map_TemplateBll.UpdateTemp(has1);
                            Hashtable has2 = new Hashtable();
                            has2["FMapTempID"] = Request["tbxFMapTempID"];
                            has2["FCenter"]    = Request["tbxLngLat"];
                            Bll.Map_TemplateBll.UpdateTempProperty(has2);
                        }

                        ShowNotify("修改成功!");
                        // 关闭本窗体(触发窗体的关闭事件)
                        PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
                    }
                    else
                    {
                        ShowNotify("客户名重复,请更换!");
                    }
                }
            }
            catch
            {
                ShowNotify("修改失败!");
            }

            return(UIHelper.Result());
        }