예제 #1
0
파일: Utils.cs 프로젝트: bigbigwood/daan
        /// <summary>删除大众平台订单
        ///
        /// </summary>
        /// <param name="barcode"></param>
        /// <returns></returns>
        public static string deleteOrderByBarcode(string barcode)
        {
            string result_Fail = "0|";
            string result_Suss = "1|";

            if (string.IsNullOrEmpty(barcode))
            {
                return(result_Fail + ErrorCode.Update_0001);
            }
            if (barcode.Length != 12 || barcode.Substring(barcode.Length - 2) != "00")
            {
                return(result_Fail + ErrorCode.Update_0002);
            }

            //检验条码号是否合格且存在于体检系统
            DataTable dtBarcode = barcodeservice.CheckBarCode2(barcode);

            if (dtBarcode != null && dtBarcode.Rows.Count > 0)
            {
                //判断已存在的条码是否来自大众平台
                if (!dtBarcode.Rows[0]["enterby"].ToString().Contains("大众平台"))
                {
                    //条码已存在且不是通过大众平台上传
                    return(result_Fail + ErrorCode.Update_0004);
                }
                else
                {
                    //判断该条码是否已经同步到康源系统,否则不允许修改;
                    if (dtBarcode.Rows[0]["transed"].ToString() == "1")
                    {
                        return(result_Fail + ErrorCode.Update_0005);
                    }
                    //删除该体检系统中订单
                    string    ordernum = dtBarcode.Rows[0]["ordernum"].ToString();
                    Hashtable ht       = new Hashtable();
                    ht["ordernum"] = ordernum;
                    try
                    {
                        bool b = new ProCentralizedManagementService().DeleteOrders(ht);
                        if (b)
                        {
                            return(result_Suss + "SUCCESS");
                        }
                        else
                        {
                            return(result_Fail + ErrorCode.Update_0007);
                        }
                    }
                    catch (Exception e)
                    {
                        return(result_Fail + ErrorCode.Update_0007 + e.Message);
                    }
                }
            }
            else
            {
                return(result_Fail + ErrorCode.Update_0003);
            }
        }