Пример #1
0
        public BizLogicMsg Save_Ext(JsonMceAssetsRoll item)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            EntityObject_MCE_B_ASSETS_ROLL obj = new EntityObject_MCE_B_ASSETS_ROLL();

                            if (!string.IsNullOrEmpty(item.id))
                            {
                                obj.ID = item.id;

                                obj = HelperObject_MCE_B_ASSETS_ROLL.Get(obj);

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

                            //   obj.ASSETS_ID = item.assets_id;
                            // obj.CODE = item.code;
                            obj.NAME           = item.name;
                            obj.SAVELIMIT      = item.savelimit;
                            obj.CREATE_USER_ID = item.create_user_id;

                            if (!string.IsNullOrEmpty(item.create_time))
                            {
                                obj.CREATE_TIME = DateTime.Parse(item.create_time);
                            }

                            obj.PLAN_TYPE     = item.plan_type;
                            obj.ROLL_TYPE     = item.roll_type;
                            obj.ROLL_PROPERTY = item.roll_property;

                            obj.COMMENTS = item.comments;

                            if (string.IsNullOrEmpty(item.id))
                            {
                                obj.CODE           = GetRollCode();
                                obj.AUDIT_STATE    = 1;
                                obj.CREATE_USER_ID = Ipedf.Web.BizLogic.SystemLogic.Proxy.CurrentUser.ID;

                                HelperObject_MCE_B_ASSETS_ROLL.Save(obj, transaction);

                                EntityObject_MCE_B_ASSETS_ROLLEQUIP objEquip = new EntityObject_MCE_B_ASSETS_ROLLEQUIP();
                                objEquip.ASSETS_ID = item.assets_id;
                                objEquip.ROLL_ID   = obj.ID;
                                HelperObject_MCE_B_ASSETS_ROLLEQUIP.Save(objEquip, transaction);
                            }
                            else
                            {
                                obj.ID = item.id;
                                HelperObject_MCE_B_ASSETS_ROLL.Update(obj, transaction);

                                CauseObject_MCE_B_ASSETS_ROLLEQUIP pMCE_B_ASSETS_ROLLEQUIP = new CauseObject_MCE_B_ASSETS_ROLLEQUIP();
                                pMCE_B_ASSETS_ROLLEQUIP.ROLL_ID   = obj.ID;
                                pMCE_B_ASSETS_ROLLEQUIP.ASSETS_ID = item.assets_id;

                                DisplayObject_MCE_B_ASSETS_ROLLEQUIP[] listMCE_B_ASSETS_ROLLEQUIP = BizLogicObject_MCE_B_ASSETS_ROLLEQUIP.Proxy.Query(pMCE_B_ASSETS_ROLLEQUIP);

                                if (listMCE_B_ASSETS_ROLLEQUIP == null || listMCE_B_ASSETS_ROLLEQUIP.Length == 0)
                                {
                                    EntityObject_MCE_B_ASSETS_ROLLEQUIP objEquip = new EntityObject_MCE_B_ASSETS_ROLLEQUIP();
                                    objEquip.ASSETS_ID = item.assets_id;
                                    objEquip.ROLL_ID   = obj.ID;
                                    HelperObject_MCE_B_ASSETS_ROLLEQUIP.Save(objEquip, transaction);
                                }
                            }


                            msg.Message = obj.ID;

                            //平台自动生成代码

                            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_ROLL> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_ROLL>(ServiceUri))
                {
                    return(smgr.Service.Save_Ext(item));
                }
            }
        }
        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("参数错误.");
                }


                JsonMceAssetsRoll item = JsonConvert.DeserializeObject <JsonMceAssetsRoll>(rsb.ToString());


                if (string.IsNullOrEmpty(item.id))
                {
                    throw new Exception("请选择资产卡片案卷信息.");
                }

                BizLogicMsg msg = BizLogicObject_MCE_B_ASSETS_ROLL.Proxy.Audit_Ext(item);
                if (!msg.Succeed)
                {
                    throw new Exception(msg.Message);
                }

                jsonMsg.Succeed = 1;
            }
            catch (Exception ex)
            {
                jsonMsg.Succeed = 0;
                jsonMsg.Message = ex.Message;
            }
            finally
            {
                context.Response.Write(JsonConvert.SerializeObject(jsonMsg));
                context.Response.End();
            }
        }
Пример #3
0
        public BizLogicMsg Audit_Ext(JsonMceAssetsRoll item)
        {
            if (LocalMode)
            {
                BizLogicMsg msg = new BizLogicMsg();
                using (IDbConnection connection = IDALProvider.IDAL.PopConnection())
                {
                    using (IDbTransaction transaction = connection.BeginTransaction())
                    {
                        try
                        {
                            EntityObject_MCE_B_ASSETS_ROLL obj = new EntityObject_MCE_B_ASSETS_ROLL();
                            obj.ID = item.id;

                            obj = HelperObject_MCE_B_ASSETS_ROLL.Get(obj);

                            if (obj != null)
                            {
                                if (obj.AUDIT_STATE == 3 || obj.AUDIT_STATE == 4)
                                {
                                    throw new Exception("已经审核的案卷信息不能再审核.");
                                }

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


                                EntityObject_MCE_B_ASSETS objMCE_B_ASSETS = new EntityObject_MCE_B_ASSETS();
                                objMCE_B_ASSETS.ID = item.assets_id;

                                objMCE_B_ASSETS = HelperObject_MCE_B_ASSETS.Get(objMCE_B_ASSETS);

                                if (obj != null)
                                {
                                    objMCE_B_ASSETS.FILE_CODE = obj.CODE;
                                    HelperObject_MCE_B_ASSETS.Update(objMCE_B_ASSETS, 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_ROLL> smgr = new ServiceManager <ServiceContract_MCE_B_ASSETS_ROLL>(ServiceUri))
                {
                    return(smgr.Service.Audit_Ext(item));
                }
            }
        }