Exemple #1
0
        public override string GetQiOption(string requirement, DataRow row)
        {
            //>1,only the first option title is usefull
            //Level 1: Item ( PrintOrder +Title )
            //Level 2:   Option +requirement ; Amount
            //Level 3:   Description

            //Dim OptionOriginal As String = row("QuoteOptionText")
            //Dim optionValue As String = RemoveUnValidChars(OptionOriginal)
            //Dim newOption As String = ">Option " + optionValue + ", " + requirement + "<"
            //optionValue = ">" + optionValue + "<"

            //If OptionOriginal.Length >= 10 Then
            //    newOption = OptionOriginal.Replace(optionValue, newOption)
            //End If

            string OptionOriginal = Convert.ToString(row["QuoteOptionText"]);
            string optionValue    = VbHtml.MyHtmlDecode(OptionOriginal);
            string newOption      = "Option " + optionValue + ", " + requirement;

            if (OptionOriginal.Length > 10)
            {
                newOption   = ">" + newOption + "<";
                optionValue = ">" + optionValue + "<";
                newOption   = OptionOriginal.Replace(optionValue, newOption);
            }

            return(newOption);
        }
Exemple #2
0
        private string ConvertToF2Format(object htmlFormatString)
        {
            string s1 = "";

            if (!MyConvert.IsNullString(htmlFormatString))
            {
                s1 = VbHtml.MyHtmlDecode(htmlFormatString);

                if (MyConvert.IsNumeric(s1))
                {
                    if (!s1.Contains("$"))
                    {
                        string s2 = "$" + s1;
                        s1 = Convert.ToString(htmlFormatString);
                        s1 = s1.Replace(s1, s2);
                    }
                }
            }
            return(s1);
        }
Exemple #3
0
        public void Generate()
        {
            var       qc  = new QuoteChildren(_quoteRevID);
            DataTable tbl = qc.ItemList("Q", true);

            if (tbl == null)
            {
                return;
            }

            //
            //2. Define the destination: InvoiceItem
            var connectionSQL = new SqlConnection(SalesCenterConfiguration.ConnectionString);

            const string sqlSelectString2 = "SELECT *  FROM [Invoice_Item] WHERE ([quoteItemID] = 0) ";
            var          selectCommand2   = new SqlCommand(sqlSelectString2, connectionSQL);
            var          adapter2         = new SqlDataAdapter(selectCommand2);

            var ds2 = new DataSet();

            ds2.Tables.Clear();

            try
            {
                connectionSQL.Open();
                adapter2.Fill(ds2, "t2");

                foreach (DataRow row in tbl.Rows)
                {
                    DataRow rowNew    = ds2.Tables["t2"].NewRow();
                    int     itemIndex = ds2.Tables["t2"].Columns.Count;


                    int i = 0;
                    for (i = 1; i <= itemIndex - 1; i++)
                    {
                        rowNew[i] = row[i];
                    }

                    rowNew["qiItemTitle"] = VbHtml.MyHtmlDecode(rowNew["qiItemTitle"]);


                    string copyDetails = SalesCenterConfiguration.CopyDetailsToInvoice;
                    if (copyDetails.Trim().ToLower() == "yes")
                    {
                        object s1 = rowNew["qiDescription"];
                        rowNew["qiDescription"] = VbHtml.MyHtmlDecode(rowNew["qiDescription"]);
                        object s2 = rowNew["qiDescription"];
                        object s3 = s2;
                    }
                    else
                    {
                        rowNew["qiDescription"] = DBNull.Value;
                    }

                    rowNew["quoteRevID"] = _invoiceID;
                    rowNew["recordType"] = "I";

                    ds2.Tables["t2"].Rows.Add(rowNew);
                }

                //4. Write ds2,  back to DB

                var cb = new SqlCommandBuilder(adapter2);
                adapter2 = cb.DataAdapter;


                adapter2.Update(ds2, "t2");
            }
            catch (SqlException ex)
            {
                string errorLog = ex.Message;
            }
            finally
            {
                connectionSQL.Close();
            }
        }
Exemple #4
0
        public void insert()
        {
            //2. Define the destination: InvoiceItem
            var    ConnectionSQL    = new SqlConnection(SalesCenterConfiguration.ConnectionString);
            string SqlSelectString1 =
                "SELECT * FROM [FW_QUOTE_SERVICE] WHERE ([estRevID] = @estRevID and [recordType]=@recordType)";
            var SelectCommand1 = new SqlCommand(SqlSelectString1, ConnectionSQL);
            var adapter1       = new SqlDataAdapter(SelectCommand1);

            adapter1.SelectCommand.Parameters.Add("@estRevID", SqlDbType.Int).Value        = _sourceTitleID;
            adapter1.SelectCommand.Parameters.Add("@recordType", SqlDbType.NChar, 7).Value = _sourceType;
            var ds1 = new DataSet();

            ds1.Tables.Clear();

            try
            {
                ConnectionSQL.Open();
                int NumRowsAffected = adapter1.Fill(ds1, "t1");
                if (NumRowsAffected != 0)
                {
                    //Destination
                    DataTable t2 = ds1.Tables["t1"].Copy();
                    t2.TableName = "t2";
                    ds1.Tables.Add(t2);
                    ds1.Tables["t2"].Clear();

                    //3. Copy
                    int     itemIndex = ds1.Tables["t1"].Columns.Count;
                    DataRow row       = null;
                    DataRow rowNew    = null;
                    int     i         = 0;
                    foreach (DataRow row_loopVariable in ds1.Tables["t1"].Rows)
                    {
                        row    = row_loopVariable;
                        rowNew = ds1.Tables["t2"].NewRow();
                        for (i = 1; i <= itemIndex - 1; i++)
                        {
                            rowNew[i] = row[i];
                        }

                        rowNew["recordType"] = _myType;
                        rowNew["estRevID"]   = _myParentID;

                        int serviceID = Convert.ToInt32(row["qsServiceID"]);
                        if (serviceID != (int)NServiceID.FreeType)
                        {
                            var sd = new ServiceDefinition(serviceID);
                            rowNew["qsTitle"] = sd.ServiceTitle;
                        }
                        else
                        {
                            rowNew["qsTitle"] = VbHtml.MyHtmlDecode(rowNew["qsTitle"]);
                        }

                        rowNew["qsDescription"] = VbHtml.MyHtmlDecode(rowNew["qsDescription"]);

                        rowNew["qsAmountText"] = rowNew["qsAmount"];

                        ds1.Tables["t2"].Rows.Add(rowNew);
                    }

                    //4. Write ds2,  back to DB

                    var cb = new SqlCommandBuilder(adapter1);
                    adapter1        = cb.DataAdapter;
                    NumRowsAffected = adapter1.Update(ds1, "t2");
                }
            }
            catch (SqlException ex)
            {
                string errorLog = ex.Message;
            }
            finally
            {
                ConnectionSQL.Close();
            }
        }
Exemple #5
0
        public override void CopyItems(int myParentID, DataSet ds1, DataTable tblItems)
        {
            foreach (DataRow row in tblItems.Rows)
            {
                if (Convert.ToBoolean(row["isFinal"]))
                {
                    DataRow rowNew = ds1.Tables["t1"].NewRow();
                    rowNew["woID"]      = myParentID;
                    rowNew["estItemID"] = MyConvert.ConvertToInteger(row["quoteItemID"]);
                    string s = VbHtml.MyHtmlDecode(row["qiItemTitle"]);
                    rowNew["estItemNameText"] = s;

                    string copyDetails = SalesCenterConfiguration.CopyDetailsToWorkorder;
                    if (copyDetails.Trim().ToLower() == "yes")
                    {
                        rowNew["woDescription"] = MyConvert.ConvertToString(row["qiDescription"]);
                    }
                    else
                    {
                        rowNew["woDescription"] = DBNull.Value;
                    }

                    rowNew["woPrintOrder"]     = MyConvert.ConvertToInteger(row["qiPrintOrder"]);
                    rowNew["qty"]              = MyConvert.ConvertToInteger(row["qiQty"]);
                    rowNew["qtyPC"]            = MyConvert.ConvertToInteger(row["qiQtyPC"]);
                    rowNew["heightFromGround"] = MyConvert.ConvertToString(row["heightFromGround"]);

                    int requirement = MyConvert.ConvertToInteger(row["Requirement"]);
                    if (requirement < 10)
                    {
                        requirement = 10;
                    }

                    if (requirement == 40)
                    {
                        requirement = 41;
                    }

                    rowNew["Requirement"] = requirement;

                    rowNew["Position"] = "Outdoor";
                    if (!Convert.IsDBNull(row["Position"]))
                    {
                        rowNew["Position"] = row["Position"];
                    }

                    rowNew["fromWhere"] = NGenerateTitleFrom.Quote;

                    rowNew["scHydroInspectionRequired"] = false;
                    rowNew["scPurpose"]  = 0;
                    rowNew["scPurpose1"] = false;
                    rowNew["scPurpose2"] = false;
                    rowNew["scPurpose3"] = false;
                    rowNew["scPurpose4"] = false;

                    //Item ID
                    rowNew["nameDetailsID"] = row["nameDetailsID"];
                    //Price
                    rowNew["qiAmount"]        = MyConvert.ConvertToDouble(row["qiAmount"]);
                    rowNew["SerialID"]        = row["SerialID"];
                    rowNew["BySubcontractor"] = row["BySubcontractor"];
                    ds1.Tables["t1"].Rows.Add(rowNew);
                }
            }
        }