Exemplo n.º 1
0
        public CostData SelectCostMaster(string memberCode, string officeCode, string subject)
        {
            SqlHandling sh = new SqlHandling("M_Cost");
            DataTable   dt = sh.SelectAllData("WHERE MemberCode = '" + memberCode + "' AND OfficeCode = '" + officeCode + "' AND CostCode LIKE '" + subject + "%'");

            if (dt == null || dt.Rows.Count < 1)
            {
                return(null);
            }

            CostData cd = new CostData(dt.Rows[0]);

            return(cd);
        }
Exemplo n.º 2
0
        public CostData SelectCostMaster(string wParam)
        {
            SqlHandling sh = new SqlHandling("M_Cost");
            DataTable   dt = sh.SelectAllData("WHERE " + wParam);

            if (dt == null || dt.Rows.Count < 1)
            {
                return(null);
            }

            CostData cd = new CostData(dt.Rows[0]);

            return(cd);
        }
Exemplo n.º 3
0
        public CostData SelectCostMaster(string costCode, string officeCode)
        {
            SqlHandling sh = new SqlHandling("M_Cost");
            DataTable   dt = sh.SelectAllData("WHERE CostCode = '" + costCode + "' AND OfficeCode = '" + officeCode + "'");

            if (dt == null || dt.Rows.Count < 1)
            {
                return(null);
            }

            CostData cd = new CostData(dt.Rows[0]);

            return(cd);
        }
Exemplo n.º 4
0
        //--------------------------------------------------------//
        //      Method
        //--------------------------------------------------------//
        public object Clone()
        {
            CostData cloneData = new CostData();

            cloneData.CostID     = this.CostID;
            cloneData.CostCode   = this.CostCode;
            cloneData.Item       = this.Item;
            cloneData.ItemDetail = this.ItemDetail;
            cloneData.Unit       = this.Unit;
            cloneData.Cost       = this.Cost;
            cloneData.OfficeCode = this.OfficeCode;
            cloneData.MemberCode = this.MemberCode;

            return(cloneData);
        }
Exemplo n.º 5
0
        private CostData[] createCostDataArray(string wParam)
        {
            SqlHandling sh = new SqlHandling("M_Cost");
            DataTable   dt = sh.SelectAllData(wParam);

            if (dt == null || dt.Rows.Count < 1)
            {
                return(null);
            }

            CostData[] cmd = new CostData[dt.Rows.Count];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                cmd[i] = new CostData(dt.Rows[i]);
            }
            return(cmd);
        }
Exemplo n.º 6
0
        public CostData[] SelectCostDataJoinOsWkReport(string officeCode)
        {
            SqlHandling sh = new SqlHandling();
            DataTable   dt = sh.SelectFullDescription("DISTINCT WR.PartnerCode AS CostCode, MC.CostID AS CostID, MC.Item AS Item, "
                                                      + "MC.ItemDetail AS ItemDetail, MC.Unit AS Unit, MC.Cost AS Cost, "
                                                      + "MC.OfficeCode AS OfficeCode, MC.MemberCode AS MemberCode "
                                                      + "FROM M_Cost MC INNER JOIN D_OsWkReport WR ON MC.CostCode = WR.PartnerCode "
                                                      + "WHERE MC.OfficeCode = '" + officeCode + "' AND "
                                                      + "WR.PartnerCode BETWEEN 'F001' AND 'F998' ORDER BY WR.PartnerCode");

            if (dt == null || dt.Rows.Count < 1)
            {
                return(null);
            }

            CostData[] cmd = new CostData[dt.Rows.Count];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                cmd[i] = new CostData(dt.Rows[i]);
            }
            return(cmd);
        }
Exemplo n.º 7
0
        public int CreateExportCostMaster(string encName, string fileName)
        {
            int procCnt = 0;

            if (dt == null)
            {
                return(-1);
            }

            Encoding sjisEnc = Encoding.GetEncoding("Shift_JIS");

            using (StreamWriter writer = new StreamWriter(fileName, false, sjisEnc))
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    cmd = new CostData(dt.Rows[i]);

                    writer.WriteLine(editCostMasterLine());
                    procCnt++;
                }
                writer.Close();
            }
            return(procCnt);
        }
Exemplo n.º 8
0
        public CostData[] SelectCostDataFromCostReport(DateTime dateFr, DateTime dateTo, string officeCode, string department)
        {
            SqlHandling sh = new SqlHandling();
            DataTable   dt = sh.SelectFullDescription("DISTINCT ItemCode FROM D_CostReport WHERE (ReportDate BETWEEN '" + dateFr + "' AND '" + dateTo
                                                      + "') AND OfficeCode = '" + officeCode + "' AND Department = '" + department
                                                      + "' AND ItemCode LIKE 'A%' ORDER BY ItemCode");

            string[] itemArray = new string[1];
            int      itemCnt   = 0;

            if (dt != null && dt.Rows.Count > 0)
            {
                itemArray = new string[dt.Rows.Count];
                itemCnt   = dt.Rows.Count;
                DataRow dr;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    dr           = dt.Rows[i];
                    itemArray[i] = Convert.ToString(dr["ItemCode"]);
                }
            }

            dt = sh.SelectFullDescription("DISTINCT SubCoCode FROM D_CostReport WHERE (ReportDate BETWEEN '" + dateFr + "' AND '" + dateTo
                                          + "') AND OfficeCode = '" + officeCode + "' AND Department = '" + department
                                          + "' AND SubCoCode BETWEEN 'F001' AND 'F998' ORDER BY SubCoCode");
            string[] subCoArray = new string[1];
            int      subCoCnt   = 0;

            if (dt != null && dt.Rows.Count > 0)
            {
                subCoArray = new string[dt.Rows.Count];
                subCoCnt   = dt.Rows.Count;
                DataRow dr;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    dr            = dt.Rows[i];
                    subCoArray[i] = Convert.ToString(dr["SubCoCode"]);
                }
            }

            if ((itemCnt + subCoCnt) == 0)
            {
                return(null);
            }

            string[] costCodeArray = new string[itemCnt + subCoCnt];

            if (itemCnt == 0)
            {
                Array.Copy(subCoArray, costCodeArray, subCoCnt);
            }
            else
            {
                Array.Copy(itemArray, costCodeArray, itemCnt);
                if (subCoCnt != 0)
                {
                    Array.Copy(subCoArray, 0, costCodeArray, itemCnt, subCoCnt);
                }
            }

            CostData cd = new CostData();

            CostData[] cmd = new CostData[costCodeArray.Length];
            for (int i = 0; i < costCodeArray.Length; i++)
            {
                cmd[i]          = new CostData();
                cmd[i].CostCode = costCodeArray[i];
                cmd[i].Item     = cd.SelectCostName(cmd[i].CostCode);
            }

            return(cmd);
        }