示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Utility.VerificationUtility ver = new Utility.VerificationUtility();
                ver.JudgeOperate(this.Page, 37, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.提交审核, NFMT.Common.OperateEnum.作废, NFMT.Common.OperateEnum.撤返, NFMT.Common.OperateEnum.执行完成, NFMT.Common.OperateEnum.执行完成撤销 });

                int contractId = 0;
                if (string.IsNullOrEmpty(Request.QueryString["id"]))
                    Response.Redirect("ContractList.aspx");
                if (!int.TryParse(Request.QueryString["id"], out contractId))
                    Response.Redirect("ContractList.aspx");

                this.navigation1.Routes.Add("合约列表", "ContractList.aspx");
                this.navigation1.Routes.Add("合约查看", string.Empty);

                //类型
                this.hidTradeDirection.Value = ((int)NFMT.Data.StyleEnum.TradeDirection).ToString();
                this.hidTradeBorder.Value = ((int)NFMT.Data.StyleEnum.TradeBorder).ToString();
                this.hidContractLimit.Value = ((int)NFMT.Data.StyleEnum.ContractLimit).ToString();
                //this.hidPriceMode.Value = ((int)NFMT.Data.StyleEnum.PriceMode).ToString();
                this.hidMarginMode.Value = ((int)NFMT.Data.StyleEnum.MarginMode).ToString();
                this.hidValueRateType.Value = ((int)NFMT.Data.StyleEnum.ValueRateType).ToString();
                this.hidDiscountBase.Value = ((int)NFMT.Data.StyleEnum.DiscountBase).ToString();
                this.hidWhoDoPrice.Value = ((int)NFMT.Data.StyleEnum.WhoDoPrice).ToString();
                this.hidSummaryPrice.Value = ((int)NFMT.Data.StyleEnum.SummaryPrice).ToString();

                user = Utility.UserUtility.CurrentUser;

                contractBLL = new NFMT.Contract.BLL.ContractBLL();
                NFMT.Contract.BLL.ContractDetailBLL detailBLL = new NFMT.Contract.BLL.ContractDetailBLL();
                NFMT.Contract.BLL.ContractPriceBLL priceBLL = new NFMT.Contract.BLL.ContractPriceBLL();
                NFMT.Contract.BLL.ContractCorporationDetailBLL corpBLL = new NFMT.Contract.BLL.ContractCorporationDetailBLL();
                NFMT.Contract.BLL.ContractDeptBLL deptBLL = new NFMT.Contract.BLL.ContractDeptBLL();

                //获取合约
                NFMT.Common.ResultModel result = contractBLL.Get(user, contractId);
                if (result.ResultStatus != 0)
                    Response.Redirect("ContractList.aspx");
                curContract = result.ReturnValue as NFMT.Contract.Model.Contract;
                if (curContract == null)
                    Response.Redirect("ContractList.aspx");

                //获取明细
                result = detailBLL.GetDetailByContractId(user, contractId);
                if (result.ResultStatus != 0)
                    Response.Redirect("ContractList.aspx");
                curContraceDetail = result.ReturnValue as NFMT.Contract.Model.ContractDetail;
                if (curContraceDetail == null)
                    Response.Redirect("ContractList.aspx");

                //获取价格
                result = priceBLL.GetPriceByContractId(user, contractId);
                if (result.ResultStatus != 0)
                    Response.Redirect("ContractList.aspx");
                curContractPrice = result.ReturnValue as NFMT.Contract.Model.ContractPrice;
                if (curContractPrice == null)
                    Response.Redirect("ContractList.aspx");

                //获取公司列表
                //我方公司
                result = corpBLL.LoadCorpListByContractId(user, contractId, true);
                if (result.ResultStatus != 0)
                    Response.Redirect("ContractList.aspx");
                curInCorps = result.ReturnValue as List<NFMT.Contract.Model.ContractCorporationDetail>;
                if (curInCorps == null || curInCorps.Count == 0)
                    Response.Redirect("ContractList.aspx");

                //对方公司
                result = corpBLL.LoadCorpListByContractId(user, contractId, false);
                if (result.ResultStatus != 0)
                    Response.Redirect("ContractList.aspx");
                curOutCorps = result.ReturnValue as List<NFMT.Contract.Model.ContractCorporationDetail>;
                if (curOutCorps == null || curOutCorps.Count == 0)
                    Response.Redirect("ContractList.aspx");

                //执行部门
                result = deptBLL.LoadDeptByContractId(user, contractId);
                if (result.ResultStatus != 0)
                    Response.Redirect("ContractList.aspx");

                curDepts = result.ReturnValue as List<NFMT.Contract.Model.ContractDept>;

                foreach (var obj in curOutCorps)
                {
                    if (curOutCorps.IndexOf(obj) > 0)
                        curOutCorpsString += ",";
                    curOutCorpsString += obj.CorpId.ToString();
                }

                foreach (var obj in this.curInCorps)
                {
                    if (curInCorps.IndexOf(obj) > 0)
                        this.curInCorpsString += ",";
                    curInCorpsString += obj.CorpId.ToString();
                }

                foreach (var obj in this.curDepts)
                {
                    if (curDepts.IndexOf(obj) > 0)
                        curDeptsString += ",";
                    curDeptsString += obj.DeptId.ToString();
                }

                System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                string json = serializer.Serialize(this.curContract);
                this.hidModel.Value = json;

                this.attach1.BusinessIdValue = this.curContract.ContractId;
            }
        }
示例#2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Utility.VerificationUtility ver = new Utility.VerificationUtility();
            ver.JudgeOperate(this.Page, 37, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.修改 });

            user = Utility.UserUtility.CurrentUser;
            string redirectUrl = "ContractOutStockList.aspx";

            this.navigation1.Routes.Add("合约列表", "ContractList.aspx");
            this.navigation1.Routes.Add("库存列表", redirectUrl);
            this.navigation1.Routes.Add("合约明细", string.Empty);

            int subId = 0;
            if (!string.IsNullOrEmpty(Request.QueryString["sid"]))
                int.TryParse(Request.QueryString["sid"], out subId);

            int contractId = 0;
            if (subId <= 0 && (string.IsNullOrEmpty(Request.QueryString["id"]) || !int.TryParse(Request.QueryString["id"], out contractId) || contractId <= 0))
                Utility.JsUtility.WarmAlert(this, "合约序号错误", redirectUrl);

            NFMT.Common.ResultModel result = new NFMT.Common.ResultModel();
            NFMT.Contract.BLL.ContractSubBLL subBLL = new NFMT.Contract.BLL.ContractSubBLL();
            NFMT.Contract.BLL.ContractDetailBLL detailBLL = new NFMT.Contract.BLL.ContractDetailBLL();
            NFMT.Contract.BLL.ContractPriceBLL priceBLL = new NFMT.Contract.BLL.ContractPriceBLL();
            NFMT.Contract.BLL.ContractCorporationDetailBLL corpBLL = new NFMT.Contract.BLL.ContractCorporationDetailBLL();
            NFMT.Contract.BLL.ContractDeptBLL deptBLL = new NFMT.Contract.BLL.ContractDeptBLL();

            //主合约进入
            if (contractId > 0)
            {
                result = contractBLL.Get(user, contractId);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this, "合约不存在", redirectUrl);

                NFMT.Contract.Model.Contract contract = result.ReturnValue as NFMT.Contract.Model.Contract;
                if (contract == null || contract.ContractId <= 0)
                    Utility.JsUtility.WarmAlert(this, "合约不存在", redirectUrl);

                if (contract.CreateFrom != (int)NFMT.Common.CreateFromEnum.销售合约库存创建)
                    Utility.JsUtility.WarmAlert(this, "合约创建来源不正确", redirectUrl);

                this.curContract = contract;

                result = subBLL.GetSubByContractId(user, contract.ContractId);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this, "子合约获取失败", redirectUrl);

                NFMT.Contract.Model.ContractSub sub = result.ReturnValue as NFMT.Contract.Model.ContractSub;
                if (sub == null || sub.SubId <= 0)
                    Utility.JsUtility.WarmAlert(this, "子合约获取失败", redirectUrl);

                this.curSub = sub;
            }
            else if (subId > 0)//子合约进入
            {
                result = subBLL.Get(user, subId);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this, "子合约获取失败", redirectUrl);

                NFMT.Contract.Model.ContractSub sub = result.ReturnValue as NFMT.Contract.Model.ContractSub;
                if (sub == null || sub.SubId <= 0)
                    Utility.JsUtility.WarmAlert(this, "子合约获取失败", redirectUrl);

                this.curSub = sub;

                result = contractBLL.Get(user, sub.ContractId);
                if (result.ResultStatus != 0)
                    Utility.JsUtility.WarmAlert(this, "合约不存在", redirectUrl);

                NFMT.Contract.Model.Contract contract = result.ReturnValue as NFMT.Contract.Model.Contract;
                if (contract == null || contract.ContractId <= 0)
                    Utility.JsUtility.WarmAlert(this, "合约不存在", redirectUrl);

                if (contract.CreateFrom != (int)NFMT.Common.CreateFromEnum.销售合约库存创建)
                    Utility.JsUtility.WarmAlert(this, "合约创建来源不正确", redirectUrl);

                this.curContract = contract;
            }

            //获取合约品种
            NFMT.Data.Model.Asset asset = NFMT.Data.BasicDataProvider.Assets.FirstOrDefault(temp => temp.AssetId == this.curContract.AssetId);
            if (asset == null || asset.AssetId <= 0)
                Utility.JsUtility.WarmAlert(this, "合约品种获取失败", redirectUrl);

            this.curAsset = asset;

            //获取明细
            result = detailBLL.GetDetailByContractId(user, this.curContract.ContractId);
            if (result.ResultStatus != 0)
                Utility.JsUtility.WarmAlert(this, "合约明细获取失败", redirectUrl);
            curContraceDetail = result.ReturnValue as NFMT.Contract.Model.ContractDetail;
            if (curContraceDetail == null)
                Utility.JsUtility.WarmAlert(this, "合约明细获取失败", redirectUrl);

            //获取价格
            result = priceBLL.GetPriceByContractId(user, this.curContract.ContractId);
            if (result.ResultStatus != 0)
                Utility.JsUtility.WarmAlert(this, "合约价格获取失败", redirectUrl);
            curContractPrice = result.ReturnValue as NFMT.Contract.Model.ContractPrice;
            if (curContractPrice == null)
                Utility.JsUtility.WarmAlert(this, "合约价格获取失败", redirectUrl);

            //获取公司列表
            //我方公司
            result = corpBLL.LoadCorpListByContractId(user, this.curContract.ContractId, true);
            if (result.ResultStatus != 0)
                Utility.JsUtility.WarmAlert(this, "合约我方抬头获取失败", redirectUrl);
            List<NFMT.Contract.Model.ContractCorporationDetail> inCorps = result.ReturnValue as List<NFMT.Contract.Model.ContractCorporationDetail>;
            if (inCorps == null || inCorps.Count == 0)
                Utility.JsUtility.WarmAlert(this, "合约我方抬头获取失败", redirectUrl);

            //对方公司
            result = corpBLL.LoadCorpListByContractId(user, this.curContract.ContractId, false);
            if (result.ResultStatus != 0)
                Utility.JsUtility.WarmAlert(this, "合约对方抬头获取失败", redirectUrl);
            List<NFMT.Contract.Model.ContractCorporationDetail> outCorps = result.ReturnValue as List<NFMT.Contract.Model.ContractCorporationDetail>;
            if (outCorps == null || outCorps.Count == 0)
                Utility.JsUtility.WarmAlert(this, "合约对方抬头获取失败", redirectUrl);

            //执行部门
            result = deptBLL.LoadDeptByContractId(user, this.curContract.ContractId);
            if (result.ResultStatus != 0)
                Response.Redirect("ContractList.aspx");

            List<NFMT.Contract.Model.ContractDept> depts = result.ReturnValue as List<NFMT.Contract.Model.ContractDept>;

            foreach (var obj in outCorps)
            {
                if (outCorps.IndexOf(obj) > 0)
                    curOutCorpsString += ",";
                curOutCorpsString += obj.CorpId.ToString();
            }

            foreach (var obj in inCorps)
            {
                if (inCorps.IndexOf(obj) > 0)
                    this.curInCorpsString += ",";
                curInCorpsString += obj.CorpId.ToString();
            }

            foreach (var obj in depts)
            {
                if (depts.IndexOf(obj) > 0)
                    curDeptsString += ",";
                curDeptsString += obj.DeptId.ToString();
            }

            //合约类型
            NFMT.Contract.BLL.ContractTypeDetailBLL contractTypeBLL = new NFMT.Contract.BLL.ContractTypeDetailBLL();
            result = contractTypeBLL.LoadContractTypesById(user, this.curContract.ContractId);
            if (result.ResultStatus != 0)
                this.WarmAlert("合约类型获取失败", redirectUrl);
            List<NFMT.Contract.Model.ContractTypeDetail> contractTypes = result.ReturnValue as List<NFMT.Contract.Model.ContractTypeDetail>;
            if (contractTypes == null)
                this.WarmAlert("合约类型获取失败", redirectUrl);
            foreach (NFMT.Contract.Model.ContractTypeDetail contractType in contractTypes)
            {
                if (contractTypes.IndexOf(contractType) > 0)
                    this.curContractTypesString += ",";

                this.curContractTypesString += contractType.ContractType.ToString();
            }

            int pageIndex = 1;
            int pageSize = 100;
            string orderStr = string.Empty;
            NFMT.WareHouse.BLL.StockLogBLL stockLogBLL = new NFMT.WareHouse.BLL.StockLogBLL();
            NFMT.Common.SelectModel select = stockLogBLL.GetContractOutStockSelect(pageIndex, pageSize, orderStr, this.curSub.SubId);
            result = stockLogBLL.Load(user, select, NFMT.Common.DefaultValue.ClearAuth);
            System.Data.DataTable dt = result.ReturnValue as System.Data.DataTable;
            this.SelectedJson = Newtonsoft.Json.JsonConvert.SerializeObject(dt, new Newtonsoft.Json.Converters.DataTableConverter());

            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            string json = serializer.Serialize(this.curContract);
            this.hidModel.Value = json;

            this.attach1.BusinessIdValue = this.curContract.ContractId;
        }
示例#3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Utility.VerificationUtility ver = new Utility.VerificationUtility();
            ver.JudgeOperate(this.Page, 79, new List<NFMT.Common.OperateEnum>() { NFMT.Common.OperateEnum.录入 });

            NFMT.Common.UserModel user = Utility.UserUtility.CurrentUser;

            this.hidTradeDirection.Value = ((int)NFMT.Data.StyleEnum.TradeDirection).ToString();
            this.hidTradeBorder.Value = ((int)NFMT.Data.StyleEnum.TradeBorder).ToString();
            //this.hidContractLimit.Value = ((int)NFMT.Data.StyleEnum.ContractLimit).ToString();
            //this.hidPriceMode.Value = ((int)NFMT.Data.StyleEnum.PriceMode).ToString();
            this.hidMarginMode.Value = ((int)NFMT.Data.StyleEnum.MarginMode).ToString();
            this.hidValueRateType.Value = ((int)NFMT.Data.StyleEnum.ValueRateType).ToString();
            this.hidDiscountBase.Value = ((int)NFMT.Data.StyleEnum.DiscountBase).ToString();
            this.hidWhoDoPrice.Value = ((int)NFMT.Data.StyleEnum.WhoDoPrice).ToString();
            this.hidSummaryPrice.Value = ((int)NFMT.Data.StyleEnum.SummaryPrice).ToString();

            this.navigation1.Routes.Add("子合约列表", "SubList.aspx");
            this.navigation1.Routes.Add("合约列表","ContractSubList.aspx");
            this.navigation1.Routes.Add("子合约添加",string.Empty);

            int contractId = 0;
            if (string.IsNullOrEmpty(Request.QueryString["id"]))
                Response.Redirect("ContractSubList.asxp");
            if(!int.TryParse(Request.QueryString["id"],out contractId))
                Response.Redirect("ContractSubList.asxp");

            //NFMT.Contract.BLL.ContractBLL bll = new NFMT.Contract.BLL.ContractBLL();
            //NFMT.Common.ResultModel result = bll.Get(user, contractId);
            //if(result.ResultStatus!=0)
            //    Response.Redirect("ContractSubList.asxp");

            //this.curContract = result.ReturnValue as NFMT.Contract.Model.Contract;
            //if(this.curContract==null || this.curContract.ContractId<=0)
            //    Response.Redirect("ContractSubList.asxp");

            NFMT.Contract.BLL.ContractBLL contractBLL = new NFMT.Contract.BLL.ContractBLL();
            NFMT.Contract.BLL.ContractDetailBLL detailBLL = new NFMT.Contract.BLL.ContractDetailBLL();
            NFMT.Contract.BLL.ContractPriceBLL priceBLL = new NFMT.Contract.BLL.ContractPriceBLL();
            NFMT.Contract.BLL.ContractCorporationDetailBLL corpBLL = new NFMT.Contract.BLL.ContractCorporationDetailBLL();
            NFMT.Contract.BLL.ContractDeptBLL deptBLL = new NFMT.Contract.BLL.ContractDeptBLL();

            //获取合约
            NFMT.Common.ResultModel result = contractBLL.Get(user, contractId);
            if (result.ResultStatus != 0)
                Response.Redirect("ContractList.aspx");
            curContract = result.ReturnValue as NFMT.Contract.Model.Contract;
            if (curContract == null)
                Response.Redirect("ContractList.aspx");

            //获取明细
            result = detailBLL.GetDetailByContractId(user, contractId);
            if (result.ResultStatus != 0)
                Response.Redirect("ContractList.aspx");
            curContraceDetail = result.ReturnValue as NFMT.Contract.Model.ContractDetail;
            if (curContraceDetail == null)
                Response.Redirect("ContractList.aspx");

            //获取价格
            result = priceBLL.GetPriceByContractId(user, contractId);
            if (result.ResultStatus != 0)
                Response.Redirect("ContractList.aspx");
            curContractPrice = result.ReturnValue as NFMT.Contract.Model.ContractPrice;
            if (curContractPrice == null)
                Response.Redirect("ContractList.aspx");

            //获取公司列表
            //我方公司
            result = corpBLL.LoadCorpListByContractId(user, contractId, true);
            if (result.ResultStatus != 0)
                Response.Redirect("ContractList.aspx");
            curInCorps = result.ReturnValue as List<NFMT.Contract.Model.ContractCorporationDetail>;
            if (curInCorps == null || curInCorps.Count == 0)
                Response.Redirect("ContractList.aspx");

            //对方公司
            result = corpBLL.LoadCorpListByContractId(user, contractId, false);
            if (result.ResultStatus != 0)
                Response.Redirect("ContractList.aspx");
            curOutCorps = result.ReturnValue as List<NFMT.Contract.Model.ContractCorporationDetail>;
            if (curOutCorps == null || curOutCorps.Count == 0)
                Response.Redirect("ContractList.aspx");

            //执行部门
            result = deptBLL.LoadDeptByContractId(user, contractId);
            if (result.ResultStatus != 0)
                Response.Redirect("ContractList.aspx");

            curDepts = result.ReturnValue as List<NFMT.Contract.Model.ContractDept>;

            foreach (var obj in curOutCorps)
            {
                if (curOutCorps.IndexOf(obj) > 0)
                    curOutCorpsString += ",";
                curOutCorpsString += obj.CorpId.ToString();
            }

            foreach (var obj in this.curInCorps)
            {
                if (curInCorps.IndexOf(obj) > 0)
                    this.curInCorpsString += ",";
                curInCorpsString += obj.CorpId.ToString();
            }

            foreach (var obj in this.curDepts)
            {
                if (curDepts.IndexOf(obj) > 0)
                    curDeptsString += ",";
                curDeptsString += obj.DeptId.ToString();
            }
        }