Esempio n. 1
0
    private void SaveForRemoteDB(string sql, int toWorkStationID)
    {
        sql = Auto_SQL.add(
            sql                                                 //SQLString
            , "1"                                               //Status
            , ConfigurationManager.AppSettings["WorkStationID"] //ForWorkStationID
            , toWorkStationID.ToString()                        //[ToWorkStationID]
            , "0"                                               //[FromID]
            , DateTime.Now.ToString("yyyy-MM-dd hh:mm tt")      //FromTime
            , ""                                                //<UploadTime, nvarchar(256),>
            , ""                                                //<ExecuteTime, nvarchar(256),>
            , ""                                                //<ExtraField1, nvarchar(256),>
            , ""                                                //<ExtraField2, nvarchar(256),>
            , ""                                                //<ExtraField3, nvarchar(256),>
            , ""                                                //<ExtraField4, nvarchar(256),>
            , ""                                                //<ExtraField5, nvarchar(256),>
            );


        CommonManager.SQLExec(sql);
    }
    private void saveForRemoteDatabase(int TransactionMasterID)
    {
        string sql = "Select * from Pos_TransactionMaster where Pos_TransactionMasterID=" + TransactionMasterID.ToString() + ";";

        sql += "Select * from Pos_Transaction where Pos_ProductTransactionMasterID=" + TransactionMasterID + ";";

        DataSet ds = CommonManager.SQLExec(sql);

        sql = @"Declare @Pos_TransactionMasterID int";

        sql += @"
                INSERT INTO [Pos_TransactionMaster]
                           ([TransactionDate]
                           ,[Pos_TransactionTypeID]
                           ,[TransactionID]
                           ,[ToOrFromID]
                           ,[Record]
                           ,[Particulars]
                           ,[WorkSatationID]
                           ,[ExtraField1]
                           ,[ExtraField2]
                           ,[ExtraField3]
                           ,[ExtraField4]
                           ,[ExtraField5]
                           ,[AddedBy]
                           ,[AddedDate]
                           ,[UpdatedBy]
                           ,[UpdatedDate]
                           ,[RowStatusID])
                     VALUES
                           ('" + ds.Tables[0].Rows[0]["TransactionDate"].ToString() + @"'
                           ," + ds.Tables[0].Rows[0]["Pos_TransactionTypeID"].ToString() + @"
                           ," + ds.Tables[0].Rows[0]["TransactionID"].ToString() + @"
                           ," + ds.Tables[0].Rows[0]["ToOrFromID"].ToString() + @"
                           ,'" + ds.Tables[0].Rows[0]["Record"].ToString() + @"'
                           ,'" + ds.Tables[0].Rows[0]["Particulars"].ToString() + @"'
                           ," + ds.Tables[0].Rows[0]["WorkSatationID"].ToString() + @"
                           ,'" + ds.Tables[0].Rows[0]["ExtraField1"].ToString() + @"'
                           ,'" + ds.Tables[0].Rows[0]["ExtraField2"].ToString() + @"'
                           ,'" + ds.Tables[0].Rows[0]["ExtraField3"].ToString() + @"'
                           ,'" + ds.Tables[0].Rows[0]["ExtraField4"].ToString() + @"'
                           ,'" + ds.Tables[0].Rows[0]["ExtraField5"].ToString() + @"'
                           ," + ds.Tables[0].Rows[0]["AddedBy"].ToString() + @"
                           ,'" + ds.Tables[0].Rows[0]["AddedDate"].ToString() + @"'
                           ," + ds.Tables[0].Rows[0]["UpdatedBy"].ToString() + @"
                           ,'" + ds.Tables[0].Rows[0]["UpdatedDate"].ToString() + @"'
                           ," + ds.Tables[0].Rows[0]["RowStatusID"].ToString() + @");

                    SET @Pos_TransactionMasterID =SCOPE_IDENTITY();
                ";

        foreach (DataRow dr in ds.Tables[1].Rows)
        {
            sql += @"
                INSERT INTO [Pos_Transaction]
                           ([Pos_ProductID]
                           ,[Quantity]
                           ,[Pos_ProductTrasactionTypeID]
                           ,[Pos_ProductTransactionMasterID]
                           ,[WorkStationID]
                           ,[ExtraField1]
                           ,[ExtraField2]
                           ,[ExtraField3]
                           ,[ExtraField4]
                           ,[ExtraField5]
                           ,[AddedBy]
                           ,[AddedDate]
                           ,[UpdatedBy]
                           ,[UpdatedDate]
                           ,[RowStatusID])
                     VALUES
                           (" + dr["Pos_ProductID"].ToString() + @"
                           ," + dr["Quantity"].ToString() + @"
                           ," + dr["Pos_ProductTrasactionTypeID"].ToString() + @"
                           ,@Pos_TransactionMasterID
                           ," + dr["WorkStationID"].ToString() + @"
                           ,'" + dr["ExtraField1"].ToString() + @"'
                           ,'" + dr["ExtraField2"].ToString() + @"'
                           ,'" + dr["ExtraField3"].ToString() + @"'
                           ,'" + dr["ExtraField4"].ToString() + @"'
                           ,'" + dr["ExtraField5"].ToString() + @"'
                           ," + dr["AddedBy"].ToString() + @"
                           ,'" + dr["AddedDate"].ToString() + @"'
                           ," + dr["UpdatedBy"].ToString() + @"
                           ,'" + dr["UpdatedDate"].ToString() + @"'
                           ," + dr["RowStatusID"].ToString() + @");
                ";
        }

        sql = Auto_SQL.add(sql
                           , "1"
                           , ConfigurationManager.AppSettings["WorkStationID"]
                           , ddlWorkStation.SelectedValue
                           , "0"
                           , DateTime.Now.ToString("yyyy-MM-dd hh:mm tt")
                           , ""
                           , ""
                           , ""
                           , ""
                           , ""
                           , ""
                           , "");

        CommonManager.SQLExec(sql);
    }