Exemple #1
0
    public static DataSet Production_Send_To_DB(Admin_Production objAdmin_Production)
    {
        try
        {
            SqlParameter[] objSqlParameter = new SqlParameter[8];

            objSqlParameter[0] = new SqlParameter("@ChannelName", objAdmin_Production.ProductionName);
            objSqlParameter[1] = new SqlParameter("@ChannelId", objAdmin_Production.ProductionId);
            objSqlParameter[2] = new SqlParameter("@DumpChannelName", objAdmin_Production.DumpProductionName);
            objSqlParameter[3] = new SqlParameter("@Isactive", objAdmin_Production.Isactive);
            objSqlParameter[4] = new SqlParameter("@CreatedDate", objAdmin_Production.CreatedDate);
            objSqlParameter[5] = new SqlParameter("@UserId", objAdmin_Production.UserId);
            objSqlParameter[6] = new SqlParameter("@Description", objAdmin_Production.Description);
            objSqlParameter[7] = new SqlParameter("@Img", objAdmin_Production.Img);

            return(SqlHelper.ExecuteDataSet(con, CommandType.StoredProcedure, "Sp_Admin_Channel", objSqlParameter));
        }
        catch (Exception Ex)
        {
            throw Ex;
        }
    }
    public void Send_Production_Data(string Production_Name, int Production_Id, string DumpProduction_Name, bool Isactive, string Description, string Img)
    {
        try
        {
            if (Production_Name != "" && Description != "" && Img != "")
            {
                if (Session["UserCode"] != null)
                {
                    Admin_Production objAdmin_Production = new Admin_Production();

                    objAdmin_Production.ProductionName     = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(Production_Name.ToLower());
                    objAdmin_Production.ProductionId       = Production_Id;
                    objAdmin_Production.DumpProductionName = DumpProduction_Name;
                    objAdmin_Production.Isactive           = Isactive;
                    objAdmin_Production.CreatedDate        = DateTime.Now.AddHours(Connection.SetHours);
                    objAdmin_Production.UserId             = Convert.ToInt32(Session["UserId"].ToString());
                    objAdmin_Production.Description        = Description;
                    objAdmin_Production.Img = Img;

                    DataSet objDataSet = Admin_Production.Production_Send_To_DB(objAdmin_Production);
                    if (objDataSet.Tables[0].Rows[0][0].ToString() == "1")
                    {
                        if (Production_Id == 0)
                        {
                            if (Img != "")
                            {
                                fupProductionImage.SaveAs(Server.MapPath("~/ProductionImg/") + "pro" + objDataSet.Tables[0].Rows[0][1].ToString() + ".jpg");
                            }

                            btnSubmit.Visible = false;
                            ShowNotification("Production", "Inserted Successfully..", NotificationType.success);
                            Response.Redirect("frmProductionList.aspx", false);
                            txtProduction.Text  = "";
                            txtDescription.Text = "";
                            Productions_List(gvProduction, "select Channel_Id,Channel_Name,Isactive,Description from tbl_Admin_Channel where CreatedById=" + Session["UserId"].ToString() + " Order by Channel_Name");
                        }
                        else
                        {
                            if (Img != "")
                            {
                                fudUpdateImg.SaveAs(Server.MapPath("~/ProductionImg/") + "pro" + Production_Id.ToString() + ".jpg");
                            }
                            ShowNotification("Production", "Updated Successfully..", NotificationType.success);
                            Productions_List(gvProduction, "select Channel_Id,Channel_Name,Isactive,Description from tbl_Admin_Channel where CreatedById=" + Session["UserId"].ToString() + " Order by Channel_Name");
                        }
                    }
                    else if (objDataSet.Tables[0].Rows[0][0].ToString() == "-5")
                    {
                        ShowNotification("Production", "Production Already Existed..!", NotificationType.error);
                        if (Production_Id == 0)
                        {
                            txtProduction.Focus();
                        }
                        else
                        {
                            txtUpdateProduction.Focus();
                        }
                    }
                    else
                    {
                        ShowNotification("Production", "Not inserted..!", NotificationType.error);
                    }
                }
                else
                {
                    ShowNotification("Production", "Sorry, Your Session had been Expired.. So Please Logout Once & Login Again..!", NotificationType.error);
                }
            }
            else
            {
                ShowNotification("Production", "Please fill all Fields..!", NotificationType.error);
            }
        }
        catch (Exception Ex)
        {
        }
    }