public string UpdateManufacturertDetails(int Id, string Name, string Desc, string MeKey, string MeDesc, string MeTi, string Dis)
        {
            string conStr = DbConName;
            String strjson = "", tablename = "Manufacturer";

            string[] UpdateValue = { Name, Desc, MeKey, MeDesc, MeTi, Dis };
            string[] columnName  = { "Name", "Description", "MetaKeywords", "MetaDescription", "MetaTitle", "DisplayOrder" };
            DataSet  ds          = new DataSet();


            try
            {
                using (SqlConnection con = new SqlConnection(conStr))
                {
                    try
                    {
                        con.Open();
                        string         oldQuery = "select * from Manufacturer where ManufacturerId=" + Id + " ";
                        SqlCommand     cmd1     = new SqlCommand(oldQuery, con);
                        SqlDataAdapter sda      = new SqlDataAdapter(cmd1);
                        sda.Fill(ds);
                        string[]   oldValue = { ds.Tables[0].Rows[0]["Name"].ToString(), ds.Tables[0].Rows[0]["Description"].ToString(), ds.Tables[0].Rows[0]["MetaKeywords"].ToString(), ds.Tables[0].Rows[0]["MetaDescription"].ToString(), ds.Tables[0].Rows[0]["MetaTitle"].ToString(), ds.Tables[0].Rows[0]["LimitedToStores"].ToString(), ds.Tables[0].Rows[0]["DisplayOrder"].ToString() };
                        string     Query    = "update Manufacturer set Manufacturer.Name='" + Name + "',Manufacturer.Description='" + Desc + "',Manufacturer.MetaKeywords='" + MeKey + "',Manufacturer.MetaDescription='" + MeDesc + "',Manufacturer.MetaTitle='" + MeTi + "',Manufacturer.DisplayOrder='" + Dis + "',Manufacturer.UpdatedOnUtc=getdate() where Manufacturer.ManufacturerId=" + Id + "";
                        SqlCommand cmd      = new SqlCommand(Query, con);
                        cmd.ExecuteNonQuery();
                        int rowsAffected = cmd.ExecuteNonQuery();
                        if (rowsAffected == 1)
                        {
                            for (var Update = 0; Update <= UpdateValue.Length - 1; Update++)
                            {
                                AdminMigratedSaveHistory.insertData(Id, UpdateValue[Update], oldValue[Update], tablename, columnName[Update]);
                            }
                        }
                        con.Close();
                        SqlDataAdapter sda1 = new SqlDataAdapter(cmd);
                        DataSet        ds1  = new DataSet();
                        sda1.Fill(ds1);
                        strjson = Jsondata.GetJson(ds1);
                    }

                    finally
                    {
                        con.Close();
                    }
                }
            }
            catch (Exception Ex)
            {
            }

            return(strjson);
        }
Ejemplo n.º 2
0
        public string ModifyOrderDetailsStatusBasedOrderItem(string OrderProductStatus, int OrderId)
        {
            string conStr = DbConName;
            String strjson = "", tablename = "OrderProduct";

            string[] UpdateValue = { OrderProductStatus };
            string[] columnName  = { "OrderStatusId" };


            DataSet ds = new DataSet();


            try
            {
                using (SqlConnection con = new SqlConnection(conStr))
                {
                    try
                    {
                        con.Open();
                        string         oldQuery = "select OrderProduct.OrderStatusId,OrderProduct.id from OrderProduct where id=" + OrderId + " ";
                        SqlCommand     cmd1     = new SqlCommand(oldQuery, con);
                        SqlDataAdapter sda      = new SqlDataAdapter(cmd1);
                        sda.Fill(ds);
                        string[]   oldValue = { ds.Tables[0].Rows[0]["OrderStatusId"].ToString() };
                        string     Query    = "update OrderProduct set OrderStatusId=" + OrderProductStatus + " where id=" + OrderId + "";
                        SqlCommand cmd      = new SqlCommand(Query, con);
                        cmd.ExecuteNonQuery();
                        int rowsAffected = cmd.ExecuteNonQuery();
                        if (rowsAffected == 1)
                        {
                            for (var Update = 0; Update <= UpdateValue.Length - 1; Update++)
                            {
                                AdminMigratedSaveHistory.insertData(OrderId, UpdateValue[Update], oldValue[Update], tablename, columnName[Update]);
                            }
                        }
                        con.Close();
                    }


                    finally
                    {
                        con.Close();
                    }
                }
            }
            catch (Exception Ex)
            {
            }

            return(strjson);
        }
        public String modifyCategory(int id, string categoryName, string CategoryGroupTag, int GroupDisplayOrder, int DisplayOrder, string Published, string flagTopCategory)
        {
            string DbConName = ConfigurationManager.ConnectionStrings["VBuyContext"].ConnectionString;
            string conStr = DbConName;
            String strjson = "", Query = "";

            string[] updateValue = { categoryName, CategoryGroupTag, Convert.ToInt32(GroupDisplayOrder).ToString(), Convert.ToInt32(DisplayOrder).ToString(), Published };
            string[] columnName  = { "Name", "CategoryGroupTag", "GroupDisplayOrder", "DisplayOrder", "Published" };
            DataSet  ds          = new DataSet();

            try
            {
                using (SqlConnection con = new SqlConnection(conStr))
                {
                    try
                    {
                        con.Open();
                        Query = "select Name,DisplayOrder,CategoryGroupTag,GroupDisplayOrder,Published from Category where CategoryId=" + id + " ";
                        SqlCommand     cmd = new SqlCommand(Query, con);
                        SqlDataAdapter sda = new SqlDataAdapter(cmd);
                        sda.Fill(ds);
                        string[]   oldValue    = { ds.Tables[0].Rows[0]["Name"].ToString(), ds.Tables[0].Rows[0]["CategoryGroupTag"].ToString(), ds.Tables[0].Rows[0]["GroupDisplayOrder"].ToString(), ds.Tables[0].Rows[0]["DisplayOrder"].ToString(), ds.Tables[0].Rows[0]["Published"].ToString() };
                        string     modifyQuery = "update Category set Name ='" + categoryName + "',DisplayOrder=" + DisplayOrder + ",UpdatedOnUtc=getdate(),CategoryGroupTag='" + CategoryGroupTag + "',GroupDisplayOrder=" + GroupDisplayOrder + ",Published=" + Published + ",ShowOnHomePage=" + flagTopCategory + " where CategoryId=" + id + "";
                        SqlCommand cmd1        = new SqlCommand(modifyQuery, con);
                        cmd1.ExecuteNonQuery();
                        int rowsAffected = cmd1.ExecuteNonQuery();
                        if (rowsAffected == 1)
                        {
                            for (var Update = 0; Update <= updateValue.Length - 1; Update++)
                            {
                                AdminMigratedSaveHistory.insertData(id, updateValue[Update], oldValue[Update], "Category ", columnName[Update]);
                            }
                        }
                    }

                    finally
                    {
                        con.Close();
                    }
                }
            }
            catch (Exception Ex)
            {
            }
            return(strjson);
        }