Selaa lähdekoodia

修改工单类型删除接口

machenyang 8 vuotta sitten
vanhempi
commit
2f9cd5448e

+ 17 - 20
codegit/CallCenterApi/CallCenterApi.Interface/CallCenterApi.Interface/Controllers/workorder/WorkTypeController.cs

68
             if (id != null && id.Length > 0)
68
             if (id != null && id.Length > 0)
69
             {
69
             {
70
                 //获取它下面的子类别
70
                 //获取它下面的子类别
71
-                DataTable dt = new BLL.T_RepositoryCategory().GetList("F_DeleteFlag=0 and F_ParentId=" + Convert.ToInt32(id) + " and F_CategoryType=1").Tables[0];
71
+                //DataTable dt = new BLL.T_RepositoryCategory().GetList("F_DeleteFlag=0 and F_ParentId=" + Convert.ToInt32(id) + " and F_CategoryType=1").Tables[0];
72
                 string rid = string.Empty;
72
                 string rid = string.Empty;
73
-                resstr = DeleteWoType(dt.Rows[0]["F_CategoryId"].ToString());
73
+                resstr = DeleteWoType(id);
74
 
74
 
75
                 if (resstr == "")
75
                 if (resstr == "")
76
                     res = Success("删除成功");
76
                     res = Success("删除成功");
180
             string rid = string.Empty;
180
             string rid = string.Empty;
181
             if (dt.Rows.Count > 0)
181
             if (dt.Rows.Count > 0)
182
             {
182
             {
183
-                try
183
+                //先删除子类类别,再删除父类
184
+                for (int i = 0; i < dt.Rows.Count; i++)
184
                 {
185
                 {
185
-                    //先删除子类类别,再删除父类
186
-                    for (int i = 0; i < dt.Rows.Count; i++)
186
+                    rid = dt.Rows[i]["F_CategoryId"].ToString();
187
+                    if (!string.IsNullOrEmpty(rid))
187
                     {
188
                     {
188
-                        rid = dt.Rows[i]["F_CategoryId"].ToString();
189
-                        if (!string.IsNullOrEmpty(rid))
189
+                        DataTable dtsub = new BLL.T_RepositoryCategory().GetList("F_DeleteFlag=0 and F_ParentId=" + Convert.ToInt32(rid) + " and F_CategoryType=1").Tables[0];
190
+                        if (dtsub.Rows.Count > 0)
191
+                        {
192
+                            DeleteWoType(dtsub.Rows[i]["F_CategoryId"].ToString());
193
+                        }
194
+                        else
190
                         {
195
                         {
191
-                            DataTable dtsub = new BLL.T_RepositoryCategory().GetList("F_DeleteFlag=0 and F_ParentId=" + Convert.ToInt32(rid) + " and F_CategoryType=1").Tables[0];
192
-                            if (dtsub.Rows.Count > 0)
193
-                            {
194
-                                DeleteWoType(dtsub.Rows[i]["F_CategoryId"].ToString());
195
-                            }
196
-                            else
197
-                            {
198
-                                new BLL.T_RepositoryCategory().Delete(Convert.ToInt32(rid));
199
-                            }
196
+                            new BLL.T_RepositoryCategory().Delete(Convert.ToInt32(rid));
200
                         }
197
                         }
201
                     }
198
                     }
202
                 }
199
                 }
203
-                catch (Exception e)
204
-                {
205
-                    res = e.Message;
206
-                }
200
+            }
201
+            else
202
+            {
203
+                new BLL.T_RepositoryCategory().Delete(Convert.ToInt32(rid));
207
             }
204
             }
208
             return res;
205
             return res;
209
         }
206
         }