Example #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        try
        {
            IList <MrpShipPlan> mrpShipPlanList = new List <MrpShipPlan>();
            foreach (GridViewRow gvr in this.GV_Detail.Rows)
            {
                HiddenField hdfId = (HiddenField)gvr.FindControl("hdfId");
                int         id    = int.Parse(hdfId.Value);

                Label   tbQty = (Label)gvr.FindControl("tbQty");
                decimal qty   = decimal.Parse(tbQty.Text.Trim());

                MrpShipPlan mrpShipPlan = TheMrpShipPlanMgr.LoadMrpShipPlan(id);
                mrpShipPlan.Qty = qty;
                mrpShipPlanList.Add(mrpShipPlan);
            }

            TheMrpShipPlanMgr.UpdateMrpShipPlan(mrpShipPlanList);
            ShowSuccessMessage("MRP.Schedule.Update.Successfully");
        }
        catch (BusinessErrorException ex)
        {
            ShowErrorMessage("MRP.Schedule.Update.Failed");
        }
    }
    public void InitParamater(string itemCode, DateTime date, DateTime effDate, bool isFlow, string flowOrLoc, bool isWinTime)
    {
        IList <MrpShipPlan> mrpShipPlansList = TheMrpShipPlanMgr.GetMrpShipPlans((isFlow ? flowOrLoc : null), (!isFlow ? flowOrLoc : null), itemCode, effDate, date, null);


        this.GV_List.DataSource = mrpShipPlansList;
        this.GV_List.DataBind();
    }
Example #3
0
    private void DoSearch(Button button)
    {
        if (this.flowOrLoc == string.Empty)
        {
            ShowErrorMessage("MRP.Schedule.Import.CustomerSchedule.Result.SelectFlow");
            return;
        }
        else if (isFlow)
        {
            Flow flow = TheFlowMgr.LoadFlow(this.flowOrLoc);
            if (flow.Type == BusinessConstants.CODE_MASTER_ORDER_TYPE_VALUE_DISTRIBUTION)
            {
                this.PartyCode = flow.PartyTo.Code;
            }
            else
            {
                this.PartyCode = flow.PartyFrom.Code;
            }
        }
        //added by [email protected]
        //2012/5
        string plant = "";

        plant = ddlPlant.SelectedValue;
        string        ConnString = string.Empty;
        string        sqlText    = string.Empty;
        DataSet       dsTemp     = new DataSet();
        XmlTextReader reader     = new XmlTextReader(Server.MapPath("Config/properties.config"));
        XmlDocument   doc        = new XmlDocument();

        doc.Load(reader); //
        reader.Close();   //
        ConnString = doc.SelectSingleNode("/configuration/properties/connectionString").InnerText.Trim();
        sqlText    = "select distinct code from item where plant = '" + plant + "'";
        dsTemp     = SqlHelper.ExecuteDataset(ConnString, CommandType.Text, sqlText);

        List <string> listItem = new List <string>();

        foreach (DataRow dr in dsTemp.Tables[0].Rows)
        {
            listItem.Add(dr["code"].ToString());
        }
        //added end

        DetachedCriteria criteria = DetachedCriteria.For <ExpectTransitInventory>();

        criteria.Add(Expression.Eq("EffectiveDate", this.EffDate));
        expectTransitInventories = this.TheCriteriaMgr.FindAll <ExpectTransitInventory>(criteria);

        if (this.rblListFormat.SelectedIndex == 1)
        {
            this.GV_List.EnableViewState   = false;
            this.GV_Detail.EnableViewState = true;
            this.GV_Order.EnableViewState  = false;

            // this.mrpShipPlans = TheMrpShipPlanMgr.GetMrpShipPlans((isFlow ? this.flowOrLoc : null), (!isFlow ? this.flowOrLoc : null), this.itemCode, this.EffDate, this.WinDate, this.StartDate);
            this.mrpShipPlans = TheMrpShipPlanMgr.GetMrpShipPlansBB((isFlow ? this.flowOrLoc : null), (!isFlow ? this.flowOrLoc : null), this.itemCode, listItem, this.EffDate, this.WinDate, this.StartDate);

            this.GV_Detail_DataBind(mrpShipPlans, expectTransitInventories);
        }
        else
        {
            this.GV_List.EnableViewState   = true;
            this.GV_Detail.EnableViewState = false;
            this.GV_Order.EnableViewState  = false;
            if (button == this.btnSearch)
            {
                //this.mrpShipPlans = TheMrpShipPlanMgr.GetMrpShipPlans((isFlow ? this.flowOrLoc : null), (!isFlow ? this.flowOrLoc : null), this.itemCode, this.EffDate, this.WinDate, this.StartDate);
                this.mrpShipPlans = TheMrpShipPlanMgr.GetMrpShipPlansBB((isFlow ? this.flowOrLoc : null), (!isFlow ? this.flowOrLoc : null), this.itemCode, listItem, this.EffDate, this.WinDate, this.StartDate);
            }

            // IList<MrpShipPlanView> mrpShipPlanViews = TheMrpShipPlanViewMgr.GetMrpShipPlanViews((isFlow ? this.flowOrLoc : null), (!isFlow ? this.flowOrLoc : null), this.itemCode, this.EffDate, this.WinDate, this.StartDate);
            IList <MrpShipPlanView> mrpShipPlanViews = TheMrpShipPlanViewMgr.GetMrpShipPlanViewsBB((isFlow ? this.flowOrLoc : null), (!isFlow ? this.flowOrLoc : null), this.itemCode, listItem, this.EffDate, this.WinDate, this.StartDate);

            criteria = DetachedCriteria.For <ExpectTransitInventoryView>();
            criteria.Add(Expression.Eq("EffectiveDate", this.EffDate));
            IList <ExpectTransitInventoryView> transitInventoryViews = this.TheCriteriaMgr.FindAll <ExpectTransitInventoryView>(criteria);

            ScheduleView scheduleView = TheMrpShipPlanViewMgr.TransferMrpShipPlanViews2ScheduleView(mrpShipPlanViews, transitInventoryViews, this.rblFlowOrLoc.SelectedValue, this.rblDateType.SelectedValue);
            this.GV_List_DataBind(scheduleView);
        }
    }