public void SendEmail(string emailId, string FName, string LName, string status, string Reason, string Designition, string HireDate, string EmpType, string PayRates, int htmlTempID, List <Attachment> Attachments = null)
        {
            try
            {
                string  fullname = FName + " " + LName;
                DataSet ds       = AdminBLL.Instance.GetEmailTemplate(Designition, htmlTempID);// AdminBLL.Instance.FetchContractTemplate(104);

                if (ds == null)
                {
                    ds = AdminBLL.Instance.GetEmailTemplate("Admin");
                }
                else if (ds.Tables[0].Rows.Count == 0)
                {
                    ds = AdminBLL.Instance.GetEmailTemplate("Admin");
                }
                string strHeader  = ds.Tables[0].Rows[0]["HTMLHeader"].ToString(); //GetEmailHeader(status);
                string strBody    = ds.Tables[0].Rows[0]["HTMLBody"].ToString();   //GetEmailBody(status);
                string strFooter  = ds.Tables[0].Rows[0]["HTMLFooter"].ToString(); // GetFooter(status);
                string strsubject = ds.Tables[0].Rows[0]["HTMLSubject"].ToString();

                string userName = ConfigurationManager.AppSettings["VendorCategoryUserName"].ToString();
                string password = ConfigurationManager.AppSettings["VendorCategoryPassword"].ToString();

                strBody = strBody.Replace("#Email#", emailId).Replace("#email#", emailId);
                strBody = strBody.Replace("#Name#", FName).Replace("#name#", FName);
                //strBody = strBody.Replace("#Date#", dtInterviewDate.Text).Replace("#date#", dtInterviewDate.Text);
                //strBody = strBody.Replace("#Time#", ddlInsteviewtime.SelectedValue).Replace("#time#", ddlInsteviewtime.SelectedValue);
                strBody = strBody.Replace("#Designation#", Designition).Replace("#designation#", Designition);

                strFooter = strFooter.Replace("#Name#", FName).Replace("#name#", FName);
                //strFooter = strFooter.Replace("#Date#", dtInterviewDate.Text).Replace("#date#", dtInterviewDate.Text);
                //strFooter = strFooter.Replace("#Time#", ddlInsteviewtime.SelectedValue).Replace("#time#", ddlInsteviewtime.SelectedValue);
                strFooter = strFooter.Replace("#Designation#", Designition).Replace("#designation#", Designition);

                strBody = strBody.Replace("Lbl Full name", fullname);
                strBody = strBody.Replace("LBL position", Designition);
                //strBody = strBody.Replace("lbl: start date", txtHireDate.Text);
                //strBody = strBody.Replace("($ rate","$"+ txtHireDate.Text);
                strBody = strBody.Replace("Reason", Reason);
                //Hi #lblFName#, <br/><br/>You are requested to appear for an interview on #lblDate# - #lblTime#.<br/><br/>Regards,<br/>
                strBody = strHeader + strBody + strFooter;

                EditUser obj = new EditUser();
                if (status == "OfferMade")
                {
                    //TODO : commented code for missing directive using Word = Microsoft.Office.Interop.Word;
                    //obj.createForeMenForJobAcceptance(strBody, FName, LName, Designition, emailId, HireDate, EmpType, PayRates);
                }
                if (status == "Deactive")
                {
                    //TODO : commented code for missing directive using Word = Microsoft.Office.Interop.Word;
                    //obj.CreateDeactivationAttachment(strBody, FName, LName, Designition, emailId, HireDate, EmpType, PayRates);
                }

                List <Attachment> lstAttachments = new List <Attachment>();

                for (int i = 0; i < ds.Tables[1].Rows.Count; i++)
                {
                    string sourceDir = Server.MapPath(ds.Tables[1].Rows[i]["DocumentPath"].ToString());
                    if (File.Exists(sourceDir))
                    {
                        Attachment attachment = new Attachment(sourceDir);
                        attachment.Name = Path.GetFileName(sourceDir);
                        lstAttachments.Add(attachment);
                    }
                }

                if (Attachments != null)
                {
                    lstAttachments.AddRange(Attachments);
                }

                JG_Prospect.App_Code.CommonFunction.SendEmail(Designition, emailId, strsubject, strBody, lstAttachments);

                ScriptManager.RegisterStartupScript(this, this.GetType(), "UserMsg", "alert('An email notification has sent on " + emailId + ".');", true);
            }
            catch (Exception ex)
            {
                UtilityBAL.AddException("CreateSalesUser-SendEmail", Session["loginid"] == null ? "" : Session["loginid"].ToString(), ex.Message, ex.StackTrace);
            }
        }
        //Save on Shutter...

        protected void btnsave_Click(object sender, EventArgs e)
        {
            try
            {
                string filename;
                //List<string> locationpics = new List<string>();
                shutters objshutter = new shutters();



                if (ddlColor.SelectedIndex == 0)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", "alert('Please select Color.')", true);
                    return;
                }

                if (Request.QueryString[QueryStringKey.Key.ProductId.ToString()] != null)
                {
                    objshutter.estimateID = Convert.ToInt32(Request.QueryString[QueryStringKey.Key.ProductId.ToString()]);
                }
                else
                {
                    objshutter.estimateID = 0;
                }
                objshutter.ProductType = Convert.ToInt32(hidProdType.Value);
                objshutter.CustomerNm  = txtCustomer.Text;
                //objshutter.CustomerId = Convert.ToInt32(Session["CustomerId"]);
                // if (Session[SessionKey.Key.CustomerId.ToString()] != null)
                //{
                objshutter.CustomerId = Convert.ToInt16(Request.QueryString[1]);//Convert.ToInt32(Session[SessionKey.Key.CustomerId.ToString()]);
                //}
                objshutter.ShutterId    = Convert.ToInt32(ddlshuttername.SelectedValue);
                objshutter.ShutterName  = ddlshuttername.Text;
                objshutter.ShutterTopId = Convert.ToInt32(ddlShutterTop.SelectedValue);
                objshutter.Shutters_top = ddlShutterTop.Text;
                objshutter.workarea     = txtWork_area.Text;

                List <CustomerLocationPic> pics = (List <CustomerLocationPic>)ViewState[SessionKey.Key.PagedataTable.ToString()];

                var    image     = pics.AsEnumerable().Take(1);
                string mainImage = image.FirstOrDefault().LocationPicture;

                objshutter.CustomerLocationPics = pics;
                objshutter.MainImage            = mainImage;

                objshutter.ColorCode = ddlColor.SelectedValue.ToString();
                objshutter.Color     = ddlColor.Text;
                List <Shutter_accessories> lstaccessorie = new List <Shutter_accessories>();
                Shutter_accessories        accessories   = new Shutter_accessories();
                accessories.accessories = ddlaccessories.Text;
                accessories.quantity    = Convert.ToInt32(txtqty.Text);
                lstaccessorie.Add(accessories);
                int value = Convert.ToInt32(hdncount.Value);
                for (int i = 1; i <= value; i++)
                {
                    Shutter_accessories item = new Shutter_accessories();
                    string accessorie        = "accessories" + i.ToString();
                    string qty = "qty" + i.ToString();
                    if (Request.Form[accessorie] != null)
                    {
                        item.accessories = Request.Form[accessorie].ToString();
                        item.quantity    = Convert.ToInt32(Request.Form[qty].ToString());
                        lstaccessorie.Add(item);
                    }
                }
                objshutter.ShutterAccessories  = lstaccessorie;
                objshutter.surfaceofmount      = Convert.ToInt32(ddlSurface_mount.SelectedValue);
                objshutter.specialinstructions = txtSpcl_inst.Text;
                objshutter.ShutterWidthId      = Convert.ToInt32(ddlWidth.SelectedValue);
                objshutter.width    = ddlWidth.Text;
                objshutter.height   = txtHeight.Text;
                objshutter.quantity = Convert.ToInt32(txtQuantity.Text);

                objshutter.UserId = userId;
                bool result = shuttersBLL.Instance.AddShutterEstimate(objshutter);
                if (result)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "AlertBox", "alert('New Shutter estimate has been added successfully');", true);
                    clearcontrols();
                    //Response.Redirect("~/Sr_App/ProductEstimate.aspx?CustomerId=" + objshutter.CustomerId);
                    Response.Redirect("~/Sr_App/ProductEstimate.aspx", false);
                }
            }
            catch (Exception ex)
            {
                UtilityBAL.AddException("Shutters-btnsave_Click", Session["loginid"] == null ? "" : Session["loginid"].ToString(), ex.Message, ex.StackTrace);
            }
        }