Ejemplo n.º 1
0
        public int Update(SqlTransaction trans, AllocationModel model)
        {
            int num = 0;

            if (model.Acode != "")
            {
                num = AllocationAction.Update(trans, model);
            }
            return(num);
        }
Ejemplo n.º 2
0
        public int Delete(SqlTransaction trans, string acode)
        {
            int num = 0;

            if (acode != "")
            {
                num = AllocationAction.Delete(trans, acode);
            }
            return(num);
        }
Ejemplo n.º 3
0
        public DataTable GetMaterialOfDepositoryList(string depositoryId, string strWhere)
        {
            DataTable materialOfDepositoryList = new DataTable();

            if (depositoryId != "")
            {
                materialOfDepositoryList = AllocationAction.GetMaterialOfDepositoryList(depositoryId, strWhere);
            }
            return(materialOfDepositoryList);
        }
Ejemplo n.º 4
0
        public int Update(AllocationStockModel stockModel)
        {
            int num = 0;

            if (stockModel.Asid != "")
            {
                num = AllocationAction.Update(stockModel);
            }
            return(num);
        }
Ejemplo n.º 5
0
        public DataTable GetTreasuryNameByCode(string code)
        {
            DataTable treasuryNameByCode = new DataTable();

            if (code != "")
            {
                treasuryNameByCode = AllocationAction.GetTreasuryNameByCode(code);
            }
            return(treasuryNameByCode);
        }
Ejemplo n.º 6
0
        public int Insert(SqlTransaction trans, AllocationStockModel stockModel)
        {
            int num = 0;

            if ((stockModel.ACode != "") && (stockModel.SCode != ""))
            {
                num = AllocationAction.Insert(trans, stockModel);
            }
            return(num);
        }
Ejemplo n.º 7
0
    protected void btnAllDel_ServerClick(object sender, EventArgs e)
    {
        AllocationAction.DelAllocationStockBill(this.lblAllocationNo.Text);
        DataTable dataTable = this.ViewState["DataTable"] as DataTable;

        dataTable.Rows.Clear();
        this.ViewState["DataTable"]    = dataTable;
        this.GVMaterialList.DataSource = null;
        this.GVMaterialList.DataBind();
    }
Ejemplo n.º 8
0
        public int DelAllocationStock(string acode)
        {
            int num = 0;

            if (acode != "")
            {
                num = AllocationAction.DelAllocationStock(acode);
            }
            return(num);
        }
Ejemplo n.º 9
0
 public Cats.Models.ProjectCodeAllocation convertToEntityModel(AllocationAction allocationAction)
 {
     return(new Cats.Models.ProjectCodeAllocation
     {
         SINumberID = allocationAction.ShippingInstructionId,
         Amount_FromSI = (int)allocationAction.AllocatedAmount,
         ProjectCodeAllocationID = allocationAction.AllocationId,
         AlloccationDate = DateTime.Now,
         AllocatedBy = 1,
         HubAllocationID = allocationAction.HubAllocationID
     });
 }
Ejemplo n.º 10
0
        public int ExistSameData(string acode, string scode, string corp, decimal price)
        {
            int num = 0;

            if ((acode != "") && (corp != ""))
            {
                object obj2 = AllocationAction.ExistData(acode, scode, corp, price);
                if (obj2 != null)
                {
                    num = int.Parse(obj2.ToString());
                }
            }
            return(num);
        }
Ejemplo n.º 11
0
        public DataTable GetTreasuryList(int tflag)
        {
            DataTable table = new DataTable();

            if (!(tflag.ToString() != ""))
            {
                return(table);
            }
            if (tflag != -1)
            {
                return(AllocationAction.GetTreasuryList(tflag.ToString()));
            }
            return(AllocationAction.GetTreasuryList(null));
        }
Ejemplo n.º 12
0
        public string GetUserNameByCode(string code)
        {
            object userNameByCode = null;

            if (code != "")
            {
                userNameByCode = AllocationAction.GetUserNameByCode(code);
            }
            if (userNameByCode != null)
            {
                return(userNameByCode.ToString());
            }
            return("");
        }
Ejemplo n.º 13
0
    protected void btnBind_ServerClick(object sender, EventArgs e)
    {
        this.UpdateDataSource();
        DataTable  dataTable = this.ViewState["DataTable"] as DataTable;
        DataTable  materialOfDepositoryList = AllocationAction.GetMaterialOfDepositoryList(this.HdnSelectOutDepo.Value, this.HdnViewCodeList.Value);
        DataColumn dataColumn = new DataColumn("Total", typeof(decimal));

        dataColumn.DefaultValue = 0m;
        materialOfDepositoryList.Columns.Add(dataColumn);
        if (dataTable != null && materialOfDepositoryList != null)
        {
            if (dataTable.Rows.Count == 1 && string.IsNullOrEmpty(dataTable.Rows[0]["scode"].ToString()))
            {
                dataTable.Rows.RemoveAt(0);
            }
            dataTable.PrimaryKey = new DataColumn[]
            {
                dataTable.Columns["scode"],
                dataTable.Columns["sprice"],
                dataTable.Columns["corp"]
            };
            materialOfDepositoryList.PrimaryKey = new DataColumn[]
            {
                materialOfDepositoryList.Columns["scode"],
                materialOfDepositoryList.Columns["sprice"],
                materialOfDepositoryList.Columns["corp"]
            };
            dataTable.Merge(materialOfDepositoryList, true);
            this.ViewState["DataTable"] = dataTable;
        }
        if (dataTable.Rows.Count > 0)
        {
            this.GVMaterialList.DataSource = dataTable;
            this.GVMaterialList.DataBind();
            string total = Convert.ToDecimal(dataTable.Compute("SUM(Total)", string.Empty)).ToString("0.000");
            GridViewUtility.AddTotalRow(this.GVMaterialList, total, 12);
            return;
        }
        this.GVMaterialList.DataSource = dataTable;
        this.GVMaterialList.DataBind();
    }
Ejemplo n.º 14
0
        public int InDepositoryConfirm(string acode, string yhdm)
        {
            DataTable         table = AllocationAction.GetAllocation_StockList("sma.acode='" + acode + "' and flowstate=1 and isouta=1 ");
            int               num   = 0;
            TreasuryPermitBll bll   = new TreasuryPermitBll();
            AllocationModel   model = new AllocationModel();

            model = this.ReturnAllocatonModel(" acode='" + acode + "' ");
            if (!bll.IsPermitAccept(model.Acode, yhdm))
            {
                return(0);
            }
            if (table.Rows.Count > 0)
            {
                TreasuryStock      stock  = new TreasuryStock();
                TreasuryStockModel model2 = new TreasuryStockModel();
                for (int i = 0; i < table.Rows.Count; i++)
                {
                    model2.corp    = table.Rows[i]["corp"].ToString();
                    model2.incode  = acode;
                    model2.intime  = DateTime.Now;
                    model2.intype  = 0;
                    model2.Type    = "A";
                    model2.isfirst = false;
                    model2.scode   = table.Rows[i]["scode"].ToString();
                    model2.snumber = decimal.Parse(table.Rows[i]["number"].ToString());
                    model2.sprice  = decimal.Parse(table.Rows[i]["sprice"].ToString());
                    model2.tcode   = table.Rows[i]["tcodeb"].ToString();
                    model2.tsid    = Guid.NewGuid().ToString();
                    if (stock.Add(model2) <= 0)
                    {
                        return(-1);
                    }
                    AllocationAction.UpdateState(true, true, acode, "In");
                    num = 1;
                }
            }
            return(num);
        }
Ejemplo n.º 15
0
        public AllocationModel ReturnAllocatonModel(string strWhere)
        {
            AllocationModel model          = new AllocationModel();
            DataTable       allocationList = new DataTable();

            allocationList = AllocationAction.GetAllocationList(strWhere);
            if (allocationList.Rows.Count > 0)
            {
                model.Aid                 = allocationList.Rows[0]["aid"].ToString();
                model.Acode               = allocationList.Rows[0]["acode"].ToString();
                model.TCodea              = allocationList.Rows[0]["tcodea"].ToString();
                model.TCodeb              = allocationList.Rows[0]["tcodeb"].ToString();
                model.IsOutA              = Convert.ToBoolean(allocationList.Rows[0]["isouta"].ToString());
                model.IsInB               = Convert.ToBoolean(allocationList.Rows[0]["isinb"].ToString());
                model.Person              = allocationList.Rows[0]["person"].ToString();
                model.InTime              = allocationList.Rows[0]["intime"].ToString();
                model.Explain             = allocationList.Rows[0]["explain"].ToString();
                model.OutAllocationPerson = allocationList.Rows[0]["OutAllocationPerson"].ToString();
                model.InAllocationPerson  = allocationList.Rows[0]["InAllocationPerson"].ToString();
            }
            return(model);
        }
Ejemplo n.º 16
0
 protected DataTable ReportAlocationDataSource(string strWhere)
 {
     return(AllocationAction.AllocationReportData(strWhere));
 }
Ejemplo n.º 17
0
        public int OutDepositoryConfirm(string acode, string yhdm)
        {
            DataTable         table = AllocationAction.GetAllocation_StockList("sma.acode='" + acode + "' and flowstate=1 ");
            DataTable         materialDetailsOfDeposity = new DataTable();
            int               num  = 0;
            decimal           num2 = 0M;
            TreasuryPermitBll bll  = new TreasuryPermitBll();

            for (int i = 0; i < table.Rows.Count; i++)
            {
                decimal num4 = 0M;
                bool    flag = bll.IsPermitBool(table.Rows[i]["tcodea"].ToString(), yhdm);
                object  materialNumberOfDepository = AllocationAction.GetMaterialNumberOfDepository(table.Rows[i]["tcodea"].ToString(), " scode='" + table.Rows[i]["scode"].ToString() + "' and sprice='" + table.Rows[i]["sprice"].ToString() + "' and corp='" + table.Rows[i]["corp"].ToString() + "' ");
                if (!flag)
                {
                    num = -3;
                    break;
                }
                if (materialNumberOfDepository != null)
                {
                    num4 = decimal.Parse(materialNumberOfDepository.ToString());
                }
                num2 = decimal.Parse(table.Rows[i]["number"].ToString());
                if (num4 < num2)
                {
                    num = -2;
                    break;
                }
            }
            switch (num)
            {
            case -2:
            case -3:
                return(num);

            default:
                for (int j = 0; j < table.Rows.Count; j++)
                {
                    decimal num6 = 0M;
                    num6 = decimal.Parse(table.Rows[j]["number"].ToString());
                    materialDetailsOfDeposity = AllocationAction.GetMaterialDetailsOfDeposity("tcode='" + table.Rows[j]["tcodea"].ToString() + "' and scode='" + table.Rows[j]["scode"].ToString() + "' and sprice='" + table.Rows[j]["sprice"].ToString() + "' and corp='" + table.Rows[j]["corp"].ToString() + "' order by intime asc ");
                    for (int k = 0; k < materialDetailsOfDeposity.Rows.Count; k++)
                    {
                        decimal num8 = 0M;
                        num8 = decimal.Parse(materialDetailsOfDeposity.Rows[k]["snumber"].ToString());
                        if (num8 > num6)
                        {
                            if (AllocationAction.UpdateNumberOfTreasury(materialDetailsOfDeposity.Rows[k]["tsid"].ToString(), num8 - num6) <= 0)
                            {
                                num = -1;
                            }
                            else
                            {
                                Common2.AlarmMethod(table.Rows[j]["tcodea"].ToString(), table.Rows[j]["scode"].ToString());
                            }
                            break;
                        }
                        if (num8 == num6)
                        {
                            if (new TreasuryStock().Delete(materialDetailsOfDeposity.Rows[k]["tsid"].ToString()) <= 0)
                            {
                                num = -1;
                            }
                            else
                            {
                                Common2.AlarmMethod(table.Rows[j]["tcodea"].ToString(), table.Rows[j]["scode"].ToString());
                            }
                            break;
                        }
                        if (num8 < num6)
                        {
                            if (new TreasuryStock().Delete(materialDetailsOfDeposity.Rows[k]["tsid"].ToString()) <= 0)
                            {
                                num = -1;
                                break;
                            }
                            num6 -= num8;
                            Common2.AlarmMethod(table.Rows[j]["tcodea"].ToString(), table.Rows[j]["scode"].ToString());
                        }
                    }
                    if (num == -1)
                    {
                        break;
                    }
                    num = 1;
                }
                break;
            }
            if (num == 1)
            {
                AllocationAction.UpdateState(true, false, acode, "Out");
            }
            return(num);
        }
Ejemplo n.º 18
0
 public DataTable GetAllocationStockList(string depositoryId, string strWhere)
 {
     return(AllocationAction.GetAllocationStockList(depositoryId, strWhere));
 }
Ejemplo n.º 19
0
 public DataTable GetAllocationList(string strWhere)
 {
     return(AllocationAction.GetAllocationList(strWhere));
 }