浏览代码

bug919修改

lihai 7 年之前
父节点
当前提交
bc34c22921

+ 16 - 5
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/customer/CustomerController.cs

194
                     string mobile = RequestString.GetFormString("mobile");
194
                     string mobile = RequestString.GetFormString("mobile");
195
                     //获取当前表格选择的客户
195
                     //获取当前表格选择的客户
196
                     int cid = Utils.StrToInt(RequestString.GetFormString("cid"), 0);
196
                     int cid = Utils.StrToInt(RequestString.GetFormString("cid"), 0);
197
+                    #region 2018-05-03 lihai 添加验证判断
198
+                    if (string.IsNullOrEmpty(name))
199
+                        return Error("姓名不能为空!");
200
+                    if (string.IsNullOrEmpty(province))
201
+                        return Error("省份不能为空!");
202
+                    if (!Validate.IsHasCHZN(province))
203
+                        return Error("请输入有效的省份!");
204
+                    if (!Validate.IsValidPhoneAndMobile(mobile))
205
+                        return Error("请输入有效的电话号码");
206
+                    #endregion
197
 
207
 
198
                     Model.T_Cus_CustomerBase model = new Model.T_Cus_CustomerBase();
208
                     Model.T_Cus_CustomerBase model = new Model.T_Cus_CustomerBase();
199
                     BLL.T_Cus_CustomerBase bll = new BLL.T_Cus_CustomerBase();
209
                     BLL.T_Cus_CustomerBase bll = new BLL.T_Cus_CustomerBase();
212
                         int n = bll.Add(model);
222
                         int n = bll.Add(model);
213
                         if (n > 0)
223
                         if (n > 0)
214
                         {
224
                         {
215
-                            res = Success("新增成功!", model);
225
+                            return Success("新增成功!", model);
216
                         }
226
                         }
217
                         else
227
                         else
218
                         {
228
                         {
219
-                            res = Error("新增失败!");
229
+                            return Error("新增失败!");
220
                         }
230
                         }
221
                     }
231
                     }
222
                     else
232
                     else
230
                             model.F_Telephone = mobile;
240
                             model.F_Telephone = mobile;
231
                             if (bll.Update(model))
241
                             if (bll.Update(model))
232
                             {
242
                             {
233
-                                res = Success("修改成功!", model);
243
+                                return Success("修改成功!", model);
234
                             }
244
                             }
235
                             else
245
                             else
236
                             {
246
                             {
237
-                                res = Error("修改失败!");
247
+                                return Error("修改失败!");
238
                             }
248
                             }
239
                         }
249
                         }
240
                     }
250
                     }
253
                     }
263
                     }
254
                     CacheHelper.Insert("LDDep", lddep);
264
                     CacheHelper.Insert("LDDep", lddep);
255
                 }
265
                 }
266
+                return Error("参数错误");
256
 
267
 
257
             }
268
             }
258
-            return res;
269
+            return Error("未知错误,请重新登录");
259
         }
270
         }
260
 
271
 
261
         /// <summary>
272
         /// <summary>