示例#1
0
文件: GenericData.cs 项目: kyas21/FTB
        public int CreateExportTaskData(string encName, string fileName)
        {
            int procCnt = 0;

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

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

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

                    writer.WriteLine(editTaskDataLine());
                    procCnt++;
                }
                writer.Close();
            }
            return(procCnt);
        }
示例#2
0
        public bool EditTaskEntryData(TaskEntryData ted, TaskCodeNameData tcnd, int entryID)
        {
            ted.TaskEntryID = entryID;
            ted.TaskCode    = tcnd.TaskCode;
            ted.TaskName    = tcnd.TaskName;
            ted.CostType    = "";
            ted.OfficeCode  = tcnd.OfficeCode;
            ted.Department  = tcnd.Department;
            TaskIndData tid = new TaskIndData();

            tid             = tid.SelectTaskIndData(tcnd.TaskCode);
            ted.LeaderMCode = tid.LeaderMCode;
            TaskData td = new TaskData();

            td = td.SelectTaskData(tid.TaskID);
            ted.PartnerCode  = td.PartnerCode;
            ted.SalesMCode   = td.SalesMCode;
            ted.ContractDate = td.IssueDate;
            ted.StartDate    = td.StartDate;
            ted.EndDate      = td.EndDate;
            ted.TaskID       = td.TaskID;
            ted.TaskIndID    = tid.TaskIndID;
            PartnersData pd = new PartnersData();

            ted.PartnerName = pd.SelectPartnerName(td.PartnerCode);
            ted.TaskPlace   = string.IsNullOrEmpty(td.TaskPlace) ? "" : td.TaskPlace;
            return(true);
        }
示例#3
0
        public bool UpdateTaskCodeOsWkReport(int slipNo, int reportID, string dTaskCode)
        {
            TaskIndData tid = new TaskIndData();

            tid = tid.SelectInfoAboutTask(dTaskCode);

            string updOsWkDetail = "UPDATE D_OsWkDetail SET TaskCode = @tCod WHERE SlipNo = @slip";
            string updOsWkReport = "UPDATE D_OsWkReport SET TaskCode = @tCod WHERE OsWkReportID = @oRID";

            using (TransactionScope tran = new TransactionScope())
                using (SqlConnection conn = new SqlConnection(ConnectionString))
                {
                    try
                    {
                        conn.Open();

                        SqlCommand cmdCostReport = new SqlCommand(updCostReport, conn);
                        cmdCostReport = forTaskCodeSetCostReportDataforTaskCode(cmdCostReport, slipNo, tid);
                        if (TryExecute(conn, cmdCostReport) < 0)
                        {
                            return(false);
                        }

                        SqlCommand cmdOsWkDetail = new SqlCommand(updOsWkDetail, conn);
                        cmdOsWkDetail.Parameters.Add("@slip", SqlDbType.Int);
                        cmdOsWkDetail.Parameters.Add("@tCod", SqlDbType.Char);
                        cmdOsWkDetail.Parameters["@slip"].Value = slipNo;
                        cmdOsWkDetail.Parameters["@tCod"].Value = dTaskCode;
                        if (TryExecute(conn, cmdOsWkDetail) < 0)
                        {
                            return(false);
                        }

                        SqlCommand cmdOsWkReport = new SqlCommand(updOsWkReport, conn);
                        cmdOsWkReport.Parameters.Add("@oRID", SqlDbType.Int);
                        cmdOsWkReport.Parameters.Add("@tCod", SqlDbType.Char);
                        cmdOsWkReport.Parameters["@oRID"].Value = reportID;
                        cmdOsWkReport.Parameters["@tCod"].Value = dTaskCode;
                        if (TryExecute(conn, cmdOsWkReport) < 0)
                        {
                            return(false);
                        }
                    }
                    catch (SqlException sqle)
                    {
                        MessageBox.Show("SQLエラー errorno " + Convert.ToString(sqle.Number) + " " + sqle.Message);
                        conn.Close();
                        return(false);
                    }
                    conn.Close();
                    tran.Complete();
                }
            return(true);
        }
示例#4
0
文件: TaskIndData.cs 项目: kyas21/FTB
        public TaskIndData SelectInfoAboutTask(string taskCode)
        {
            TaskIndData tid = new TaskIndData();

            tid = SelectTaskIndData(taskCode);
            TaskData td = new TaskData();

            td              = td.SelectTaskData(tid.TaskID);
            tid.SalesMCode  = td.SalesMCode;
            tid.PartnerCode = td.PartnerCode;
            return(tid);
        }
示例#5
0
文件: TaskIndData.cs 项目: kyas21/FTB
        public TaskIndData SelectTaskIndSData(string wParam)
        {
            TaskIndData tid;
            SqlHandling sh = new SqlHandling("D_TaskInd");
            DataTable   dt = sh.SelectAllData(wParam);

            if (dt == null || dt.Rows.Count < 1)
            {
                return(null);
            }
            tid = new TaskIndData(dt.Rows[0]);
            return(tid);
        }
示例#6
0
文件: TaskIndData.cs 项目: kyas21/FTB
        public TaskIndData SelectTaskIndData(int taskID, string officeCode, string department)
        {
            TaskIndData tid = new TaskIndData();
            SqlHandling sh  = new SqlHandling("D_TaskInd");
            DataTable   dt  = sh.SelectAllData("WHERE TaskID = " + taskID + " AND OfficeCode = '" + officeCode + "' AND Department = '" + department + "'");

            if (dt == null || dt.Rows.Count < 1)
            {
                return(null);
            }
            tid = new TaskIndData(dt.Rows[0]);

            return(tid);
        }
示例#7
0
文件: TaskIndData.cs 项目: kyas21/FTB
        public TaskIndData SelectTaskIndData(string taskCode)
        {
            TaskIndData tid = new TaskIndData();
            SqlHandling sh  = new SqlHandling("D_TaskInd");
            DataTable   dt  = sh.SelectAllData("WHERE TaskCode = '" + taskCode + "'");

            if (dt == null || dt.Rows.Count < 1)
            {
                return(null);
            }
            tid = new TaskIndData(dt.Rows[0]);

            return(tid);
        }
示例#8
0
文件: TaskIndData.cs 项目: kyas21/FTB
        private TaskIndData[] editTaskIndDataArray(string sqlStr)
        {
            SqlHandling sh = new SqlHandling("D_TaskInd");
            DataTable   dt = sh.SelectAllData(sqlStr);

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

            TaskIndData[] tid;
            tid = new TaskIndData[dt.Rows.Count];
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                tid[i] = new TaskIndData(dt.Rows[i]);
            }
            return(tid);
        }
示例#9
0
文件: TaskIndData.cs 项目: kyas21/FTB
 private SqlCommand addValue(SqlCommand cmd, TaskIndData tid)
 {
     cmd.Parameters["@tIID"].Value = tid.TaskIndID;
     cmd.Parameters["@tCod"].Value = tid.TaskCode;
     cmd.Parameters["@cont"].Value = tid.Contract;
     cmd.Parameters["@pMrk"].Value = tid.ProvMark;
     cmd.Parameters["@tID"].Value  = tid.TaskID;
     cmd.Parameters["@adCD"].Value = tid.AdminCode;
     cmd.Parameters["@cDtA"].Value = tid.ConfirmDateA;
     cmd.Parameters["@lMCd"].Value = tid.LeaderMCode;
     cmd.Parameters["@cDtC"].Value = tid.ConfirmDateC;
     cmd.Parameters["@oCod"].Value = tid.OfficeCode;
     cmd.Parameters["@tNam"].Value = tid.TaskName;
     cmd.Parameters["@vNo"].Value  = tid.VersionNo;
     cmd.Parameters["@oVM"].Value  = tid.OldVerMark;
     cmd.Parameters["@dept"].Value = tid.Department;
     cmd.Parameters["@isMk"].Value = tid.IssueMark;
     cmd.Parameters["@oTyp"].Value = tid.OrdersType;
     return(cmd);
 }
示例#10
0
        public TaskCodeNameData[] SelectTaskCodeNameFromCostReport(DateTime dateFr, DateTime dateTo, string scCode, string officeCode)
        {
            string selParam = "DISTINCT TaskCode FROM D_CostReport WHERE ( ReportDate BETWEEN '" + dateFr + "' AND '" + dateTo + "') "
                              + "AND OfficeCode = '" + officeCode + "' AND ";

            selParam += scCode[0] == 'F' ? "SubCoCode = " : "ItemCode = ";
            selParam += "'" + scCode + "' ORDER BY TaskCode";

            SqlHandling sh = new SqlHandling();
            DataTable   dt = sh.SelectFullDescription(selParam);

            if (dt == null || dt.Rows.Count < 1)
            {
                return(null);
            }
            string[] taskCdArray = new string[dt.Rows.Count];
            DataRow  dr;

            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dr             = dt.Rows[i];
                taskCdArray[i] = Convert.ToString(dr["TaskCode"]);
            }

            StringUtility utl = new StringUtility();
            TaskIndData   tid = new TaskIndData();

            TaskCodeNameData[] tcd = new TaskCodeNameData[taskCdArray.Length];
            for (int i = 0; i < taskCdArray.Length; i++)
            {
                tcd[i]          = new TaskCodeNameData();
                tcd[i].TaskCode = taskCdArray[i];
                tid             = tid.SelectTaskIndData(utl.SubstringByte(tcd[i].TaskCode, 2, 3) == "999"
                                            ? utl.SubstringByte(tcd[i].TaskCode, 0, 1) + Convert.ToString(DHandling.FisicalYear() - 2000) + utl.SubstringByte(tcd[i].TaskCode, 1, 1) + "999"
                                            : tcd[i].TaskCode);
                tcd[i].TaskName    = tid.TaskName;
                tcd[i].LeaderMCode = tid.LeaderMCode;
            }

            return(tcd);
        }
示例#11
0
文件: TaskIndData.cs 项目: kyas21/FTB
        //--------------------------------------------------------//
        //      Method
        //--------------------------------------------------------//

        public object Clone()
        {
            TaskIndData cloneData = new TaskIndData();

            cloneData.TaskIndID    = this.TaskIndID;
            cloneData.TaskCode     = this.TaskCode;
            cloneData.Contract     = this.Contract;
            cloneData.ProvMark     = this.ProvMark;
            cloneData.TaskID       = this.TaskID;
            cloneData.AdminCode    = this.AdminCode;
            cloneData.ConfirmDateA = this.ConfirmDateA;
            cloneData.LeaderMCode  = this.LeaderMCode;
            cloneData.ConfirmDateC = this.ConfirmDateC;
            cloneData.OfficeCode   = this.OfficeCode;
            cloneData.TaskName     = this.TaskName;
            cloneData.VersionNo    = this.VersionNo;
            cloneData.OldVerMark   = this.OldVerMark;
            cloneData.Department   = this.Department;
            cloneData.IssueMark    = this.IssueMark;
            cloneData.OrdersType   = this.OrdersType;

            cloneData.ProcType = this.ProcType;
            return(cloneData);
        }
示例#12
0
        private SqlCommand forTaskCodeSetCostReportDataforTaskCode(SqlCommand cmd, int slipNo, TaskIndData tid)
        {
            //TaskIndData tid = new TaskIndData();
            //tid = tid.SelectInfoAboutTask( taskCode );

            cmd.Parameters.Add("@slip", SqlDbType.Int);
            cmd.Parameters.Add("@tCod", SqlDbType.Char);
            cmd.Parameters.Add("@cust", SqlDbType.Char);
            cmd.Parameters.Add("@lCod", SqlDbType.Char);
            cmd.Parameters.Add("@sCod", SqlDbType.Char);
            cmd.Parameters["@slip"].Value = slipNo;
            cmd.Parameters["@tCod"].Value = tid.TaskCode;
            cmd.Parameters["@cust"].Value = tid.PartnerCode;
            cmd.Parameters["@lCod"].Value = tid.LeaderMCode;
            cmd.Parameters["@sCod"].Value = tid.SalesMCode;

            return(cmd);
        }
示例#13
0
文件: GenericData.cs 项目: kyas21/FTB
        //public string CostType { get; set; }

        //--------------------------------------------------------//
        //      Method
        //--------------------------------------------------------//
        /// <summary>
        /// コスト情報(D_CostReport)を指定条件で読取り、
        /// 「商魂」で読込可能な汎用データファイル(売上明細情報)を
        /// 作成する
        /// </summary>
        /// <param name="encName"> 作成するファイルの文字エンコード名 </param>
        /// <param name="fileName"> 作成ファイル名 </param>
        /// <returns></returns>
        public int CreateGenricData_CostReport(string encName, string fileName)
        {
            int procCnt = 0;

            if (dt == null)
            {
                return(-1);
            }
            if (dt.Rows.Count < 1)
            {
                return(-1);
            }
            DataRow dr;

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

            using (StreamWriter writer = new StreamWriter(fileName, false, sjisEnc))
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    dr         = dt.Rows[i];
                    ReportDate = Convert.ToDateTime(dr["ReportDate"]);
                    SlipNo     = Convert.ToInt32(dr["SlipNo"]);
                    ItemCode   = Convert.ToString(dr["ItemCode"]);
                    Item       = Convert.ToString(dr["Item"]);
                    Quantity   = Convert.ToDecimal(dr["Quantity"]);
                    Unit       = Convert.ToString(dr["Unit"]);
                    UnitPrice  = Convert.ToDecimal(dr["UnitPrice"]);
                    Cost       = Convert.ToDecimal(dr["Cost"]);
                    Note       = Convert.ToString(dr["Note"]);
                    MemberCode = Convert.ToString(dr["MemberCode"]);
                    OfficeCode = Convert.ToString(dr["OfficeCode"]);
                    Department = Convert.ToString(dr["Department"]);
                    //LeaderMCode = Convert.ToString(dr["LeaderMCode"]);
                    Subject = Convert.ToString(dr["Subject"]);

                    if (TaskCode != Convert.ToString(dr["TaskCode"]))
                    {
                        TaskCode = Convert.ToString(dr["TaskCode"]);

                        //SqlHandling sh = new SqlHandling();
                        //string sqlStr = "TaskName FROM D_TaskInd WHERE OldVerMark = 0 AND TaskCode = '" + TaskCode + "'";
                        //taskdt = sh.SelectFullDescription(sqlStr);
                        //if ((taskdt == null) || (taskdt.Rows.Count < 1))

                        tid = new TaskIndData();
                        tid = tid.SelectTaskIndSData("WHERE OldVerMark = 0 AND TaskCode = '" + TaskCode + "'");
                        if (tid == null)
                        {
                            TaskName    = "";
                            LeaderMCode = Convert.ToString(dr["LeaderMCode"]);
                        }
                        else
                        {
                            //taskdr = taskdt.Rows[0];
                            //TaskName = Convert.ToString(taskdr["TaskName"]);
                            TaskName    = tid.TaskName;
                            LeaderMCode = tid.LeaderMCode;
                        }
                    }

                    writer.WriteLine(editTextLine());
                    procCnt++;
                }
                writer.Close();
            }
            return(procCnt);
        }