コード例 #1
0
        protected void btnnext_Click(object sender, EventArgs e)
        {
            iProductMasterClient productClient = new iProductMasterClient();
            CustomProfile        profile       = CustomProfile.GetProfile();

            try
            {
                ds = productClient.GetPriceImportData(DeptID, profile.DBConnection._constr);
                dt = ds.Tables[0];
                for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
                {
                    string  SkuCode = ds.Tables[0].Rows[i]["SKUCode"].ToString();
                    decimal Price   = decimal.Parse(ds.Tables[0].Rows[i]["Price"].ToString());
                    productClient.UpdateImportSkuPrice(SkuCode, Price, DeptID, profile.DBConnection._constr);
                }
                productClient.DeleteSKUPricetemp(profile.DBConnection._constr);
                Response.Redirect("ImportPriceF.aspx");
            }
            catch
            {
                productClient.DeleteSKUPricetemp(profile.DBConnection._constr);
            }
            finally
            {
                productClient.Close();
            }
        }
コード例 #2
0
        protected void Btncancel_Click(object sender, EventArgs e)
        {
            iProductMasterClient productClient = new iProductMasterClient();
            CustomProfile        profile       = CustomProfile.GetProfile();

            productClient.DeleteSKUPricetemp(profile.DBConnection._constr);
            productClient.Close();
        }
コード例 #3
0
        protected void btnback_Click(object sender, EventArgs e)
        {
            iProductMasterClient productClient = new iProductMasterClient();
            CustomProfile        profile       = CustomProfile.GetProfile();

            productClient.DeleteSKUPricetemp(profile.DBConnection._constr);
            productClient.Close();
            Response.Redirect("ImportPriceD.aspx");
        }
コード例 #4
0
        protected void btnnext_Click(object sender, EventArgs e)
        {
            DataSet              ds1 = new DataSet();
            DataTable            dt1 = new DataTable();
            iProductMasterClient productClient = new iProductMasterClient();
            iPartRequestClient   objService = new iPartRequestClient();
            CustomProfile        profile = CustomProfile.GetProfile();
            decimal              TotalProdQty = 0m, totalPrice = 0m;
            string   Title = "Direct Order Import";
            string   OrderNumber = "";
            DateTime orderdate = DateTime.Now;

            try
            {
                ds = productClient.GetDistinctPLCodes(profile.DBConnection._constr);
                //ds = productClient.GetDirectOrderData(profile.DBConnection._constr);
                dt = ds.Tables[0];
                for (int i = 0; i <= ds.Tables[0].Rows.Count - 1; i++)
                {
                    DataSet   ds2         = new DataSet();
                    DataTable dt2         = new DataTable();
                    long      disDeptid   = long.Parse(ds.Tables[0].Rows[i]["deptId"].ToString());
                    long      DisLocId    = long.Parse(ds.Tables[0].Rows[i]["LocID"].ToString());
                    long      CompanyID   = long.Parse(ds.Tables[0].Rows[i]["ParentID"].ToString());
                    long      Orderheadid = 0;
                    ds2 = productClient.GetTotalForOrderHead(disDeptid, DisLocId, profile.DBConnection._constr);
                    dt2 = ds2.Tables[0];
                    if (dt2.Rows.Count > 0)
                    {
                        TotalProdQty = decimal.Parse(dt2.Rows[0]["TotalOrderQty"].ToString());
                        totalPrice   = decimal.Parse(dt2.Rows[0]["GrandTotalPrice"].ToString());
                    }
                    OrderNumber = productClient.getOrderFormatNumber(disDeptid, profile.DBConnection._constr);
                    ds1         = productClient.GetImportDatabyDisDeptLocId(disDeptid, DisLocId, profile.DBConnection._constr);
                    dt1         = ds1.Tables[0];
                    long sequence = 0;
                    for (int j = 0; j <= ds1.Tables[0].Rows.Count - 1; j++)
                    {
                        long UOMID = 16;

                        string  skucode          = ds1.Tables[0].Rows[j]["SKUCode"].ToString();
                        string  SkuName          = ds1.Tables[0].Rows[j]["Name"].ToString();
                        string  Description      = ds1.Tables[0].Rows[j]["Description"].ToString();
                        decimal AvailableBalance = decimal.Parse(ds1.Tables[0].Rows[j]["AvailableBalance"].ToString());
                        decimal RequestQty       = decimal.Parse(ds1.Tables[0].Rows[j]["asRequestQty"].ToString());
                        decimal OrderQty         = decimal.Parse(ds1.Tables[0].Rows[j]["OrderQty"].ToString());
                        decimal Price            = decimal.Parse(ds1.Tables[0].Rows[j]["Price"].ToString());
                        decimal Total            = decimal.Parse(ds1.Tables[0].Rows[j]["Total"].ToString());
                        long    locationid       = long.Parse(ds1.Tables[0].Rows[j]["locationid"].ToString());
                        long    prodID           = long.Parse(ds1.Tables[0].Rows[j]["prodID"].ToString());
                        long    storeID          = long.Parse(ds1.Tables[0].Rows[j]["ID"].ToString());
                        decimal Dispatch         = decimal.Parse(ds1.Tables[0].Rows[j]["TotalDispatchQty"].ToString());
                        //TotalProdQty = TotalProdQty + OrderQty;
                        //totalPrice = totalPrice + Total;
                        long     maxdeldays          = productClient.GetmaxDeliverydays(storeID, profile.DBConnection._constr);
                        DateTime Deliveryday         = DateTime.Now.AddDays(maxdeldays);
                        decimal  CurrentAvailBalance = AvailableBalance - OrderQty;
                        decimal  CurrentDispatchQty  = Dispatch + OrderQty;

                        sequence = sequence + 1;
                        if (j == 0)
                        {
                            Orderheadid = productClient.SaveOrderHeaderImport(storeID, orderdate, Deliveryday, 0, 3, profile.Personal.UserID, DateTime.Now, Title, DateTime.Now, TotalProdQty, totalPrice, OrderNumber, locationid, profile.DBConnection._constr);
                        }
                        productClient.SaveOrderDetailImport(Orderheadid, prodID, OrderQty, UOMID, sequence, SkuName, Description, skucode, Price, Total, profile.DBConnection._constr);
                        productClient.updateproductstockdetailimport(storeID, prodID, CurrentAvailBalance, CurrentDispatchQty, profile.DBConnection._constr);
                    }
                    productClient.ImportMsgTransHeader(Orderheadid, profile.DBConnection._constr);
                    int x = objService.EmailSendWhenRequestSubmit(Orderheadid, profile.DBConnection._constr);

                    DataSet dss = new DataSet();
                    dss = objService.GetApproverDepartmentWise(disDeptid, profile.DBConnection._constr);
                    for (int t = 0; t <= dss.Tables[0].Rows.Count - 1; t++)
                    {
                        long approverid = Convert.ToInt64(dss.Tables[0].Rows[t]["UserId"].ToString());

                        objService.EmailSendofApproved(approverid, Orderheadid, profile.DBConnection._constr);
                    }
                }

                productClient.DeleteOrderImport(profile.DBConnection._constr);
                Response.Redirect("ImportOrderF.aspx");
            }
            catch
            {
                productClient.DeleteSKUPricetemp(profile.DBConnection._constr);
            }
            finally
            {
                productClient.Close();
            }
        }
コード例 #5
0
        protected void btnUploadPo_Click(object sender, EventArgs e)
        {
            con1.ConnectionString = ConfigurationManager.ConnectionStrings["elegantcrm7ConnectionString"].ConnectionString;
            DataSet              ds            = new DataSet();
            DataTable            dt            = new DataTable();
            iProductMasterClient productClient = new iProductMasterClient();
            CustomProfile        profile       = CustomProfile.GetProfile();

            Label1.Text = "";
            try
            {
                if (ddlcompany.SelectedValue != "0" && ddldepartment.SelectedValue != "0")
                {
                    productClient.DeleteSKUPricetemp(profile.DBConnection._constr);

                    string connString  = "";
                    string path        = FileuploadPO.PostedFile.FileName;
                    string strFileType = System.IO.Path.GetExtension(path).ToString().ToLower();

                    string Fullpath = Server.MapPath("~/Product/ImportPrice/" + path);

                    //if (strFileType.Trim() != ".xls")
                    //{
                    //    Label1.Text = "Please upload only Excel files with .xls extention!";
                    //}
                    //else
                    //{
                    Label1.Text = "";
                    FileuploadPO.PostedFile.SaveAs(Server.MapPath("~/Product/ImportPrice/" + path));

                    if (strFileType.Trim() == ".xls")
                    {
                        connString = @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Fullpath + ";Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=2\"";
                    }
                    else if (strFileType.Trim() == ".xlsx")
                    {
                        connString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + Fullpath + ";Extended Properties='Excel 12.0;HDR=Yes'";
                    }
                    OleDbConnection excelConnection = new OleDbConnection(connString);
                    OleDbCommand    cmd1            = new OleDbCommand("Select * from [Template$]", excelConnection);

                    excelConnection.Open();
                    OleDbDataReader dReader;
                    dReader = cmd1.ExecuteReader();
                    SqlBulkCopy sqlBulk = new SqlBulkCopy(con1);
                    con1.Open();
                    sqlBulk.DestinationTableName = "TempPrice";
                    sqlBulk.WriteToServer(dReader);
                    excelConnection.Close();

                    ds = productClient.GetSkuPriceTemp(profile.DBConnection._constr);
                    dt = ds.Tables[0];

                    if (dt.Rows.Count > 0)
                    {
                        //System.Threading.Thread.Sleep(8000);
                        Label1.Text = "Upload Successful !!!";
                        lblmessagesuccess.Visible = true;
                        Button12.Enabled          = true;
                        Button12.CssClass         = "class2";
                        // adm.UpdateStudenttrim();
                    }
                    else
                    {
                        WebMsgBox.MsgBox.Show("Upload Not Successful, Please Upload Right Template");
                        ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Upload Not Successful,Please upload Right template!');", true);
                    }
                    //adm.UpdateStudenttrim();
                    //}
                }
                else
                {
                    WebMsgBox.MsgBox.Show("Please Select Company and Department");
                }
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterStartupScript(this, GetType(), "showAlert", "showAlert('" + ex.ToString() + "','Error','#');", true);
                ScriptManager.RegisterStartupScript(this, GetType(), "showalert", "alert('Exception in Catch!');", true);
            }
            finally { con1.Close(); productClient.Close(); }
        }