Exemplo n.º 1
0
        //--------------------------------------------------------//
        //      Method
        //--------------------------------------------------------//
        public new object Clone()
        {
            OutsourceData cloneData = new OutsourceData();

            cloneData.OutsourceID = this.OutsourceID;
            cloneData.TaskEntryID = this.TaskEntryID;
            cloneData.VersionNo   = this.VersionNo;
            cloneData.OrderNo     = this.OrderNo;
            cloneData.PartnerCode = this.PartnerCode;
            cloneData.PayRoule    = this.PayRoule;
            cloneData.Amount      = this.Amount;
            cloneData.OrderDate   = this.OrderDate;
            cloneData.StartDate   = this.StartDate;
            cloneData.EndDate     = this.EndDate;
            cloneData.InspectDate = this.InspectDate;
            cloneData.ReceiptDate = this.ReceiptDate;
            cloneData.Place       = this.Place;
            cloneData.Note        = this.Note;
            cloneData.OfficeCode  = this.OfficeCode;
            cloneData.Department  = this.Department;
            cloneData.OrderFlag   = this.OrderFlag;
            cloneData.PlanningID  = this.PlanningID;
            cloneData.Publisher   = this.Publisher;
            return(cloneData);
        }
Exemplo n.º 2
0
        public bool UpdateOutsource(OutsourceData osd)
        {
            if (osd == null)
            {
                return(false);
            }

            string sqlStr = "UPDATE D_Outsource SET TaskEntryID = @tenID, VersionNo = @verN, OrderNo = @order, PartnerCode = @pCode, PayRoule = @pRoule, Amount = @amt,"
                            + " OrderDate = @oDate, StartDate = @sDate, EndDate = @eDate, InspectDate = @iDate, ReceiptDate = @rDate,"
                            + " Place = @place, Note = @note, OfficeCode = @oCod, Department = @dept, OrderFlag = @oFlag WHERE OutsourceID = @osID";

            using (TransactionScope tran = new TransactionScope())
                using (SqlConnection conn = new SqlConnection(ConnectionString))
                {
                    try
                    {
                        conn.Open();
                        SqlCommand cmd = new SqlCommand(sqlStr, conn);
                        cmd = outsource_cmd(cmd, osd);
                        cmd.Parameters.Add("@osID", SqlDbType.Int);
                        cmd.Parameters["@osID"].Value = osd.OutsourceID;
                        if (TryExecute(conn, cmd) < 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);
        }
Exemplo n.º 3
0
        public int InsertOutsource(OutsourceData osd)
        {
            if (osd == null)
            {
                return(-1);
            }

            string sqlStr = "INSERT INTO D_Outsource "
                            + "(TaskEntryID, VersionNo, OrderNo, PartnerCode, PayRoule, Amount, "
                            + "OrderDate, StartDate, EndDate, InspectDate, ReceiptDate, Place, Note, OfficeCode, Department, OrderFlag) "
                            + "VALUES (@tenID, @verN, @order, @pCode, @pRoule, @amt, @oDate, @sDate, @eDate, @iDate, @rDate, @place, @note, @oCod, @dept, @oFlag)"
                            + ";SELECT CAST(scope_identity() AS int)";

            Int32 newProdID = -1;

            using (TransactionScope tran = new TransactionScope())
                using (SqlConnection conn = new SqlConnection(ConnectionString))
                {
                    try
                    {
                        conn.Open();
                        SqlCommand cmd = new SqlCommand(sqlStr, conn);
                        cmd       = outsource_cmd(cmd, osd);
                        newProdID = TryExScalar(conn, cmd);
                    }
                    catch (SqlException sqle)
                    {
                        MessageBox.Show("SQLエラー errorno " + Convert.ToString(sqle.Number) + " " + sqle.Message);
                        conn.Close();
                        return(-1);
                    }
                    conn.Close();
                    tran.Complete();
                }
            //return id;
            return((int)newProdID);
        }
Exemplo n.º 4
0
 private SqlCommand outsource_cmd(SqlCommand cmd, OutsourceData osd)
 {
     cmd.Parameters.Add("@tenID", SqlDbType.Int);
     cmd.Parameters.Add("@verN", SqlDbType.Int);
     cmd.Parameters.Add("@order", SqlDbType.Char);
     cmd.Parameters.Add("@pCode", SqlDbType.Char);
     cmd.Parameters.Add("@pRoule", SqlDbType.Int);
     cmd.Parameters.Add("@amt", SqlDbType.Decimal);
     cmd.Parameters.Add("@oDate", SqlDbType.DateTime);
     cmd.Parameters.Add("@sDate", SqlDbType.Date);
     cmd.Parameters.Add("@eDate", SqlDbType.Date);
     cmd.Parameters.Add("@iDate", SqlDbType.Date);
     cmd.Parameters.Add("@rDate", SqlDbType.Date);
     cmd.Parameters.Add("@place", SqlDbType.NVarChar);
     cmd.Parameters.Add("@note", SqlDbType.NVarChar);
     cmd.Parameters.Add("@oCod", SqlDbType.Char);
     cmd.Parameters.Add("@dept", SqlDbType.Char);
     cmd.Parameters.Add("@oFlag", SqlDbType.Int);
     cmd.Parameters["@tenID"].Value  = osd.TaskEntryID;
     cmd.Parameters["@verN"].Value   = osd.VersionNo;
     cmd.Parameters["@order"].Value  = osd.OrderNo;
     cmd.Parameters["@pCode"].Value  = osd.PartnerCode;
     cmd.Parameters["@pRoule"].Value = osd.PayRoule;
     cmd.Parameters["@amt"].Value    = osd.Amount;
     cmd.Parameters["@oDate"].Value  = osd.OrderDate;
     cmd.Parameters["@sDate"].Value  = osd.StartDate;
     cmd.Parameters["@eDate"].Value  = osd.EndDate;
     cmd.Parameters["@iDate"].Value  = osd.InspectDate;
     cmd.Parameters["@rDate"].Value  = osd.ReceiptDate;
     cmd.Parameters["@place"].Value  = osd.Place;
     cmd.Parameters["@note"].Value   = osd.Note;
     cmd.Parameters["@oCod"].Value   = osd.OfficeCode;
     cmd.Parameters["@dept"].Value   = osd.Department;
     cmd.Parameters["@oFlag"].Value  = osd.OrderFlag;
     return(cmd);
 }
Exemplo n.º 5
0
        public DataTable SelectOutsourceCont(OutsourceData osd)
        {
            string wParam = "WHERE OutsourceID = " + Convert.ToString(osd.OutsourceID) + " ORDER BY LNo";

            return(SelectAllData_Core("D_OutsourceCont", wParam));
        }