public BizLogicMsg Audit_Ext(List <string> listID)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            foreach (string strID in listID)
                            {
                                EntityObject_MCE_B_ASSETS_PURCHASE obj = new EntityObject_MCE_B_ASSETS_PURCHASE();
                                obj.ID = strID;

                                obj = HelperObject_MCE_B_ASSETS_PURCHASE.Get(obj);

                                if (obj != null)
                                {
                                    if (obj.STATE == 3 || obj.STATE == 4)
                                    {
                                        throw new Exception("已经审核的数据不能再审核.");
                                    }

                                    obj.STATE         = 3;
                                    obj.AUDIT_TIME    = DateTime.Now;
                                    obj.AUDIT_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;
                                    HelperObject_MCE_B_ASSETS_PURCHASE.Update(obj, transaction);
                                }
                            }

                            //平台自动生成代码

                            transaction.Commit();
                        }
                        catch (Exception expt)
                        {
                            transaction.Rollback();
                            msg = new BizLogicMsg(false, expt.Message);
                            Error(expt);
                        }
                        finally
                        {
                            IDALProvider.IDAL.PushConnection(connection);
                        }
                    }
                }
                return(msg);
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE>(ServiceUri))
                {
                    return(smgr.Service.Audit_Ext(listID));
                }
            }
        }
        public BizLogicMsg Delete_Ext(List <string> listID)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            foreach (string strID in listID)
                            {
                                EntityObject_MCE_B_ASSETS_PURCHASE obj = new EntityObject_MCE_B_ASSETS_PURCHASE();
                                obj.ID = strID;

                                obj = HelperObject_MCE_B_ASSETS_PURCHASE.Get(obj);

                                if (obj != null)
                                {
                                    if (obj.STATE >= 2)
                                    {
                                        throw new Exception("已经提交的数据不能删除.");
                                    }

                                    HelperObject_MCE_B_ASSETS_PURCHASE.Delete(obj, transaction);
                                }
                            }

                            //平台自动生成代码

                            transaction.Commit();
                        }
                        catch (Exception expt)
                        {
                            transaction.Rollback();
                            msg = new BizLogicMsg(false, expt.Message);
                            Error(expt);
                        }
                        finally
                        {
                            IDALProvider.IDAL.PushConnection(connection);
                        }
                    }
                }
                return(msg);
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE>(ServiceUri))
                {
                    return(smgr.Service.Delete_Ext(listID));
                }
            }
        }
Exemplo n.º 3
0
        public EntityObject_MCE_B_ASSETS_PURCHASE_PLAN_D Load(IDbTransaction transaction, string id, out EntityObject_MCE_D_MCE_TYPE type_id, out EntityObject_COM_TYPE currency_id, out EntityObject_COM_TYPE unit_id, out EntityObject_MCE_B_ASSETS_PURCHASE base_id)
        {
            if (LocalMode)
            {
                EntityObject_MCE_B_ASSETS_PURCHASE_PLAN_D obj = new EntityObject_MCE_B_ASSETS_PURCHASE_PLAN_D();

                //平台自动生成代码
                type_id     = new EntityObject_MCE_D_MCE_TYPE();
                currency_id = new EntityObject_COM_TYPE();
                unit_id     = new EntityObject_COM_TYPE();
                base_id     = new EntityObject_MCE_B_ASSETS_PURCHASE();


                obj.ID = id;
                obj    = HelperObject_MCE_B_ASSETS_PURCHASE_PLAN_D.Get(obj, transaction);
                if (!string.IsNullOrEmpty(obj.TYPE_ID))
                {
                    type_id.ID = obj.TYPE_ID;
                    type_id    = HelperObject_MCE_D_MCE_TYPE.Get(type_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.CURRENCY_ID))
                {
                    currency_id.ID = obj.CURRENCY_ID;
                    currency_id    = HelperObject_COM_TYPE.Get(currency_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.UNIT_ID))
                {
                    unit_id.ID = obj.UNIT_ID;
                    unit_id    = HelperObject_COM_TYPE.Get(unit_id, transaction);
                }
                if (!string.IsNullOrEmpty(obj.BASE_ID))
                {
                    base_id.ID = obj.BASE_ID;
                    base_id    = HelperObject_MCE_B_ASSETS_PURCHASE.Get(base_id, transaction);
                }
                return(obj);
            }
            else
            {
                throw new InvalidConstraintException();
            }
        }
Exemplo n.º 4
0
        public EntityObject_MCE_B_ASSETS_PURCHASE_PLAN_D Load(string id, out EntityObject_MCE_D_MCE_TYPE type_id, out EntityObject_COM_TYPE currency_id, out EntityObject_COM_TYPE unit_id, out EntityObject_MCE_B_ASSETS_PURCHASE base_id)
        {
            if (LocalMode)
            {
                EntityObject_MCE_B_ASSETS_PURCHASE_PLAN_D obj = new EntityObject_MCE_B_ASSETS_PURCHASE_PLAN_D();

                //平台自动生成代码
                type_id     = new EntityObject_MCE_D_MCE_TYPE();
                currency_id = new EntityObject_COM_TYPE();
                unit_id     = new EntityObject_COM_TYPE();
                base_id     = new EntityObject_MCE_B_ASSETS_PURCHASE();

                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            obj = Load(transaction, id, out type_id, out currency_id, out unit_id, out base_id);
                            transaction.Commit();
                        }
                        catch (Exception expt)
                        {
                            transaction.Rollback();
                            Error(expt);
                        }
                        finally
                        {
                            IDALProvider.IDAL.PushConnection(connection);
                        }
                    }
                }
                return(obj);
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE_PLAN_D> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE_PLAN_D>(ServiceUri))
                {
                    return(smgr.Service.Load(id, out type_id, out currency_id, out unit_id, out base_id));
                }
            }
        }
        public BizLogicMsg Audit_Ext(List <string> listID)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            foreach (string strID in listID)
                            {
                                EntityObject_MCE_B_ASSETS_PURCHASE_PLAN obj = new EntityObject_MCE_B_ASSETS_PURCHASE_PLAN();
                                obj.ID = strID;

                                obj = HelperObject_MCE_B_ASSETS_PURCHASE_PLAN.Get(obj);

                                if (obj != null)
                                {
                                    if (obj.STATE == 3 || obj.STATE == 4)
                                    {
                                        throw new Exception("已经审核的数据不能再审核.");
                                    }

                                    obj.STATE         = 3;
                                    obj.AUDIT_TIME    = DateTime.Now;
                                    obj.AUDIT_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;
                                    HelperObject_MCE_B_ASSETS_PURCHASE_PLAN.Update(obj, transaction);


                                    DisplayObject_MCE_B_ASSETS_PURCHASE_PLAN_D[] list_D = BizLogicObject_MCE_B_ASSETS_PURCHASE_PLAN_D.Proxy.Query(new CauseObject_MCE_B_ASSETS_PURCHASE_PLAN_D()
                                    {
                                        BASE_ID = obj.ID
                                    });
                                    if (list_D != null && list_D.Length > 0)
                                    {
                                        foreach (DisplayObject_MCE_B_ASSETS_PURCHASE_PLAN_D item in list_D)
                                        {
                                            if (item.REF_TAB_NAME == "MCE_B_ASSETS_PURCHASE" && !string.IsNullOrEmpty(item.REF_TAB_ID))
                                            {
                                                EntityObject_MCE_B_ASSETS_PURCHASE obj_Pur = new EntityObject_MCE_B_ASSETS_PURCHASE();
                                                obj_Pur.ID = item.REF_TAB_ID;

                                                obj_Pur = HelperObject_MCE_B_ASSETS_PURCHASE.Get(obj_Pur);
                                                if (obj_Pur != null)
                                                {
                                                    obj_Pur.REF_USED_AMOUNT = obj_Pur.REF_USED_AMOUNT + item.AMOUNT;
                                                    HelperObject_MCE_B_ASSETS_PURCHASE.Update(obj_Pur, transaction);
                                                }
                                            }
                                        }
                                    }
                                }
                            }

                            //平台自动生成代码

                            transaction.Commit();
                        }
                        catch (Exception expt)
                        {
                            transaction.Rollback();
                            msg = new BizLogicMsg(false, expt.Message);
                            Error(expt);
                        }
                        finally
                        {
                            IDALProvider.IDAL.PushConnection(connection);
                        }
                    }
                }
                return(msg);
            }
            else
            {
                using (ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE_PLAN> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_PURCHASE_PLAN>(ServiceUri))
                {
                    return(smgr.Service.Audit_Ext(listID));
                }
            }
        }
Exemplo n.º 6
0
        public void ProcessRequest(HttpContext context)
        {
            //允许跨域
            context.Response.AddHeader("Access-Control-Allow-Origin", "*");
            JSON_MSG jsonMsg = new JSON_MSG();

            try
            {
                context.Response.ContentType = "text/plain";
                HttpRequest request = context.Request;

                StringBuilder rsb       = new StringBuilder();
                int           bytelengg = (int)request.InputStream.Length;
                using (var reader = new StreamReader(request.InputStream, Encoding.UTF8))
                {
                    var read  = new Char[bytelengg];
                    var count = reader.Read(read, 0, bytelengg);
                    while (count > 0)
                    {
                        var str = new string(read, 0, count);
                        rsb.Append(str);
                        count = reader.Read(read, 0, bytelengg);
                    }
                    reader.Close();
                    reader.Dispose();
                    request.InputStream.Close();
                    request.InputStream.Dispose();
                }

                if (string.IsNullOrEmpty(rsb.ToString()))
                {
                    throw new Exception("参数错误.");
                }

                JsonMCE_PURCHASE json = JsonConvert.DeserializeObject <JsonMCE_PURCHASE>(rsb.ToString());


                if (string.IsNullOrEmpty(json.CODE))
                {
                    throw new Exception("参数错误,单号不能为空.");
                }

                if (json.APPLY_AMOUNT <= 0)
                {
                    throw new Exception("参数错误,请输入正确的申购数量.");
                }

                if (json.APPLY_MONEY <= 0)
                {
                    throw new Exception("参数错误,请输入正确预算金额.");
                }

                EntityObject_MCE_B_ASSETS_PURCHASE entity = new EntityObject_MCE_B_ASSETS_PURCHASE();
                entity.ID = json.ID;

                if (!string.IsNullOrEmpty(entity.ID))
                {
                    entity = BizLogicObject_MCE_B_ASSETS_PURCHASE.Proxy.Get(entity);

                    if (entity == null)
                    {
                        throw new Exception("获取数据出错.");
                    }
                }



                entity.CODE = json.CODE;

                entity.APPLY_AMOUNT = json.APPLY_AMOUNT;
                entity.APPLY_MONEY  = json.APPLY_MONEY;
                entity.APPLY_PRICE  = json.APPLY_PRICE;
                entity.TYPE_ID      = json.TYPE_ID;
                entity.ASSET_ID     = json.ASSET_ID;
                entity.ASSET_NAME   = json.ASSET_NAME;
                entity.SPEC         = json.SPEC;
                entity.CURRENCY_ID  = json.CURRENCY_ID;
                entity.UNIT_ID      = json.UNIT_ID;
                entity.UNIT_NAME    = json.UNIT_ID_NAME;



                if (string.IsNullOrEmpty(json.ID))
                {
                    if (!string.IsNullOrEmpty(json.PRD_ID))
                    {
                        string strPrdID          = "";
                        CauseObject_MDM_D_DEPT p = new CauseObject_MDM_D_DEPT();
                        p.REF_ID = json.PRD_ID;

                        DisplayObject_MDM_D_DEPT[] listPrd = BizLogicObject_MDM_D_DEPT.Proxy.Query(p);
                        if (listPrd != null && listPrd.Length > 0)
                        {
                            strPrdID = listPrd[0].ID;
                        }

                        entity.PRD_ID = strPrdID;
                    }

                    entity.REF_PRD_ID = json.PRD_ID;

                    if (!string.IsNullOrEmpty(json.PRV_ID))
                    {
                        string strPrvID = "";

                        CauseObject_MDM_D_DEPT p = new CauseObject_MDM_D_DEPT();
                        p.REF_ID = json.PRV_ID;

                        DisplayObject_MDM_D_DEPT[] listPrv = BizLogicObject_MDM_D_DEPT.Proxy.Query(p);
                        if (listPrv != null && listPrv.Length > 0)
                        {
                            strPrvID = listPrv[0].ID;
                        }

                        entity.PRV_ID = strPrvID;
                    }

                    entity.REF_PRV_ID = json.PRV_ID;
                }

                entity.PRD_NAME = json.PRD_ID_NAME;
                entity.PRV_NAME = json.PRV_ID_NAME;

                entity.PURCHASE_TYPE_ID = json.PURCHASE_TYPE_ID;
                entity.COMMENTS         = json.COMMENTS;

                entity.STATE = 1;
                entity.ID    = json.ID;
                entity.ID    = json.ID;

                BizLogicMsg msg = new BizLogicMsg();

                if (string.IsNullOrEmpty(entity.ID))
                {
                    entity.APPLY_DEPT_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.DEPART_ID;
                    entity.APPLY_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;

                    entity.CREATE_DEPT_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.DEPART_ID;
                    entity.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;

                    entity.CREATE_DATE = entity.CREATE_TIME = DateTime.Now;

                    msg = BizLogicObject_MCE_B_ASSETS_PURCHASE.Proxy.Save(entity);
                }
                else
                {
                    entity.MODIFY_DEPT_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.DEPART_ID;
                    entity.MODIFY_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;

                    entity.MODIFY_TIME = DateTime.Now;

                    msg = BizLogicObject_MCE_B_ASSETS_PURCHASE.Proxy.Update(entity);
                }

                if (!msg.Succeed)
                {
                    throw new Exception(msg.Message);
                }

                jsonMsg.Succeed = 1;
                jsonMsg.Message = msg.Message;
            }
            catch (Exception ex)
            {
                jsonMsg.Succeed = 0;
                jsonMsg.Message = ex.Message;
            }
            finally
            {
                context.Response.Write(JsonConvert.SerializeObject(jsonMsg));
                context.Response.End();
            }
        }