protected void Button1_Click(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     String orderId = Request.QueryString["orderId"].ToString();
     EncryptDecrypt obj = new EncryptDecrypt();
     orderId = obj.Decrypt(HttpUtility.UrlDecode(orderId));
     DatabaseHandler obj1 = new DatabaseHandler();
     String sellerUsername = Request.Cookies["Car-Trading"]["Username"].ToString();
     DataSet ds = obj1.GetSellerId(sellerUsername);
     String sellerId = ds.Tables[0].Rows[0]["SELLER_ID"].ToString();
     ds = obj1.GetSellerPendingOrderInfo(orderId);
     String customerId = ds.Tables[0].Rows[0]["CUSTOMER_ID"].ToString();
     String carId = ds.Tables[0].Rows[0]["CAR_ID"].ToString();
     String oldStock = Label5.Text;
     int oldStock1 = Convert.ToInt32(oldStock);
     int newStock = oldStock1-1;
     String newStock1 = newStock.ToString();
     obj1.DecrementCarStock(carId, newStock1);
     String paymentMode = Label10.Text;
     String customerAddr = Label9.Text;
     String orderDate = Label11.Text;
     obj1.InsertCompletedOrder(orderId, customerId, carId, sellerId, paymentMode, customerAddr, orderDate);
     Label13.Visible = true;
     Label13.Text = "Order Completed";
     Button1.Enabled = false;
 }
    protected void Button2_Click(object sender, EventArgs e)
    {
        String name = TextBox1.Text;
        String country = DropDownList1.Text;
        String city = DropDownList2.Text;
        String street=TextBox2.Text;
        String num = TextBox3.Text;
        String email = TextBox4.Text;
        String sellerProof = FileUpload1.PostedFile.FileName;
        String bank = DropDownList4.Text;
        String accountNum = TextBox5.Text;
        String uname = TextBox6.Text;
        String pword = TextBox7.Text;
        String sellerProofFolder = HttpContext.Current.Server.MapPath("~/Seller ID");
        String sellerProofTarget = Path.Combine(sellerProofFolder, sellerProof);
        FileUpload1.SaveAs(sellerProofTarget);

        DatabaseHandler obj = new DatabaseHandler();
        String sellerId = "SEL_" + DateTime.Now.Ticks.ToString();
        obj.InsertSeller(sellerId, name, country, city, street, num, email, sellerProofTarget, bank, accountNum, uname, pword);
        HttpCookie cookie = new HttpCookie("Car-Trading");
        cookie.Expires = DateTime.Now.AddDays(10);
        cookie["Username"] = uname;
        Response.Cookies.Add(cookie);
        EncryptDecrypt obj1 = new EncryptDecrypt();
        sellerId = HttpUtility.HtmlEncode(obj1.Encrypt(sellerId));
        Response.Redirect("SellerHome.aspx?sellerId=" + sellerId);
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     DataSet ds = new DataSet();
     String orderId=Request.QueryString["orderId"].ToString();
     EncryptDecrypt obj=new EncryptDecrypt();
     orderId=obj.Decrypt(HttpUtility.UrlDecode(orderId));
     DatabaseHandler obj1 = new DatabaseHandler();
     ds = obj1.GetSellerPendingOrderInfo(orderId);
     Label1.Text = ds.Tables[0].Rows[0]["CAR_BRAND"].ToString();
     Label2.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NAME"].ToString();
     Label3.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NUMBER"].ToString();
     Label4.Text = ds.Tables[0].Rows[0]["CAR_PRICE"].ToString();
     Label5.Text = ds.Tables[0].Rows[0]["CAR_STOCK_QUANTITY"].ToString();
     Label6.Text = ds.Tables[0].Rows[0]["CAR_POSSESSION_TYPE"].ToString();
     Label7.Text = ds.Tables[0].Rows[0]["CUSTOMER_FIRST_NAME"].ToString() + " " + ds.Tables[0].Rows[0]["CUSTOMER_LAST_NAME"].ToString();
     Label8.Text = ds.Tables[0].Rows[0]["CUSTOMER_PHONE_NUMBER"].ToString();
     Label9.Text = ds.Tables[0].Rows[0]["CUSTOMER_ADDRESS"].ToString();
     Label10.Text = ds.Tables[0].Rows[0]["PAYMENT_MODE"].ToString();
     Label11.Text = ds.Tables[0].Rows[0]["ORDER_DATE"].ToString();
     if (Label5.Text == "0")
     {
         Label13.Visible = true;
         Button1.Enabled = false;
         Label13.Text = "This car is out of stock";
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     EncryptDecrypt obj1 = new EncryptDecrypt();
     String carId = obj1.Decrypt(HttpUtility.UrlDecode(Request.QueryString["carId"].ToString()));
     String sellerId = obj1.Decrypt(HttpUtility.UrlDecode(Request.QueryString["sellerId"].ToString()));
     if (carId == null || sellerId == null)
         Response.Redirect("Error.aspx");
     else
     {
         DatabaseHandler obj = new DatabaseHandler();
         DataSet ds = obj.GetCarInfo(carId);
         Label1.Text = ds.Tables[0].Rows[0]["CAR_BRAND"].ToString() + " " + ds.Tables[0].Rows[0]["CAR_MODEL_NAME"].ToString();
         Label2.Text = ds.Tables[0].Rows[0]["CAR_BRAND"].ToString();
         Label3.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NAME"].ToString();
         Label4.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NUMBER"].ToString();
         Label5.Text = ds.Tables[0].Rows[0]["CAR_POSSESSION_TYPE"].ToString();
         Label6.Text = ds.Tables[0].Rows[0]["CAR_YEAR_OF_PURCHASE"].ToString();
         Label7.Text = ds.Tables[0].Rows[0]["CAR_PRICE"].ToString();
         Label8.Text = ds.Tables[0].Rows[0]["CAR_ENGINE"].ToString();
         Label9.Text = ds.Tables[0].Rows[0]["CAR_FUEL"].ToString();
         ImageButton1.ImageUrl = "~\\Car\\Front\\" + Path.GetFileName(ds.Tables[0].Rows[0]["CAR_FRONT_IMAGE"].ToString());
         ImageButton1.Width = 100;
         ImageButton1.Height = 100;
         ImageButton2.ImageUrl = "~\\Car\\Side\\" + Path.GetFileName(ds.Tables[0].Rows[0]["CAR_SIDE_IMAGE"].ToString());
         ImageButton2.Width = 100;
         ImageButton2.Height = 100;
         ImageButton3.ImageUrl = "~\\Car\\Rear\\" + Path.GetFileName(ds.Tables[0].Rows[0]["CAR_REAR_IMAGE"].ToString());
         ImageButton3.Width = 100;
         ImageButton3.Height = 100;
         ds = obj.GetSellerName(sellerId);
         Label10.Text = ds.Tables[0].Rows[0]["SELLER_NAME"].ToString();
     }
 }
 protected void Button2_Click(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     String sellerName = TextBox1.Text;
     String sellerCountry = TextBox2.Text;
     String sellerCity = TextBox3.Text;
     String sellerStreet = TextBox4.Text;
     String sellerPhone = TextBox5.Text;
     String sellerEmail = TextBox6.Text;
     String sellerBankName = TextBox7.Text;
     String sellerBankAccountNum = TextBox8.Text;
     String sellerPassword = TextBox9.Text;
     String sellerIdProof = FileUpload1.PostedFile.FileName;
     String IdProofFolder = HttpContext.Current.Server.MapPath("~/Seller ID");
     String IdProofTarget = Path.Combine(IdProofFolder, sellerIdProof);
     FileUpload1.SaveAs(IdProofTarget);
     String sellerId = Request.QueryString["sellerId"].ToString();
     EncryptDecrypt obj = new EncryptDecrypt();
     sellerId = obj.Decrypt(HttpUtility.UrlDecode(sellerId));
     DatabaseHandler obj1 = new DatabaseHandler();
     obj1.UpdateSellerInfo(sellerName, sellerCountry, sellerCity, sellerStreet, sellerPhone,
         sellerEmail, sellerIdProof, sellerBankName, sellerPhone, sellerPassword, sellerId);
     Response.Redirect("SellerHome.aspx?sellerId=" + Request.QueryString["sellerId"].ToString());
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     String sellerId = null;
     try
     {
         sellerId = Request.QueryString["sellerId"].ToString();
         EncryptDecrypt obj = new EncryptDecrypt();
         sellerId = obj.Decrypt(HttpUtility.UrlDecode(sellerId));
     }
     catch(System.NullReferenceException exc)
     {
         String sellerUsername = Request.Cookies["Car-Trading"]["Username"].ToString();
         DatabaseHandler x = new DatabaseHandler();
         DataSet ds1 = x.GetSellerId(sellerUsername);
         sellerId = ds1.Tables[0].Rows[0]["SELLER_ID"].ToString();
     }
     DatabaseHandler obj1 = new DatabaseHandler();
     DataSet ds = new DataSet();
     ds = obj1.GetSellerHomeInfo(sellerId);
     Label1.Text = ds.Tables[0].Rows[0]["SELLER_NAME"].ToString();
     Label2.Text = ds.Tables[0].Rows[0]["SELLER_COUNTRY"].ToString();
     Label3.Text = ds.Tables[0].Rows[0]["SELLER_CITY"].ToString();
     Label4.Text = ds.Tables[0].Rows[0]["SELLER_STREET"].ToString();
     Label5.Text = ds.Tables[0].Rows[0]["SELLER_PHONE_NUMBER"].ToString();
     Label6.Text = ds.Tables[0].Rows[0]["SELLER_EMAIL_ID"].ToString();
     Label7.Text = ds.Tables[0].Rows[0]["SELLER_BANK"].ToString();
     Label8.Text = ds.Tables[0].Rows[0]["SELLER_BANK_ACCOUNT_NUMBER"].ToString();
     Image1.ImageUrl = "~\\Seller ID\\" + Path.GetFileName(ds.Tables[0].Rows[0]["SELLER_ID_PROOF"].ToString());
     Image1.Width = 100;
     Image1.Height = 100;
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     this.UnobtrusiveValidationMode = System.Web.UI.UnobtrusiveValidationMode.None;
     if (!IsPostBack)
         Wizard1.ActiveStepIndex = 0;
     Panel2.Visible = false;
     Panel3.Visible = false;
     String customerUsername = Request.Cookies["Car-Trading"]["Username"].ToString();
     DatabaseHandler obj = new DatabaseHandler();
     DataSet ds = obj.GetCustomerAddressPhone(customerUsername);
     String customerAddress = ds.Tables[0].Rows[0]["CUSTOMER_ADDRESS"].ToString();
     Label1.Text = customerAddress;
     String carId = Request.QueryString["carId"].ToString();
     String sellerId = Request.QueryString["sellerId"].ToString();
     EncryptDecrypt obj1 = new EncryptDecrypt();
     carId = obj1.Decrypt(HttpUtility.UrlDecode(carId));
     sellerId = obj1.Decrypt(HttpUtility.UrlDecode(sellerId));
     ds = obj.GetSellerName(sellerId);
     Label2.Text = ds.Tables[0].Rows[0]["SELLER_NAME"].ToString();
     ds = obj.GetCarInfo(carId);
     Label3.Text = ds.Tables[0].Rows[0]["CAR_BRAND"].ToString();
     Label4.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NAME"].ToString();
     Label5.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NUMBER"].ToString();
     Label6.Text = ds.Tables[0].Rows[0]["CAR_POSSESSION_TYPE"].ToString();
     Label7.Text = ds.Tables[0].Rows[0]["CAR_PRICE"].ToString();
     Label13.Text = Label2.Text;
     Label14.Text = Label7.Text;
     ImageButton1.ImageUrl = "~\\Car\\Front\\" + Path.GetFileName(ds.Tables[0].Rows[0]["CAR_FRONT_IMAGE"].ToString());
     ImageButton1.Width = 150;
     ImageButton1.Height = 150;
 }
 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     String sellerId = GridView1.SelectedRow.Cells[0].Text;
     EncryptDecrypt obj = new EncryptDecrypt();
     sellerId = HttpUtility.UrlEncode(obj.Encrypt(sellerId));
     Response.Redirect("SellerDetails.aspx?sellerId=" + sellerId);
 }
 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     String orderId = GridView1.SelectedRow.Cells[0].Text;
     EncryptDecrypt obj = new EncryptDecrypt();
     orderId = HttpUtility.UrlEncode(obj.Encrypt(orderId));
     Response.Redirect("SellerCompletePendingOrder.aspx?orderId=" + orderId);
     Response.Write(orderId);
 }
 protected void LinkButton1_Click(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     String customerUsername = Request.Cookies["Car-Trading"]["Username"].ToString();
     DatabaseHandler obj=new DatabaseHandler();
     DataSet ds=obj.GetCustomerId(customerUsername);
     String customerId = ds.Tables[0].Rows[0]["CUSTOMER_ID"].ToString();
     EncryptDecrypt obj1 = new EncryptDecrypt();
     customerId = HttpUtility.UrlEncode(obj1.Encrypt(customerId));
     Response.Redirect("CustomerBuyCar.aspx?carId=" + Request.QueryString["carId"].ToString() + "&sellerId=" + Request.QueryString["sellerId"].ToString() + "&customerId=" + customerId);
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     int flag = 0;
     DataSet ds = new DataSet();
     DatabaseHandler obj = new DatabaseHandler();
     ds = obj.GetAllCars();
     if (ds == null)
         Label1.Text = "No car to display";
     else
     {
         int count = ds.Tables[0].Rows.Count;
         TableRow tr = new TableRow();
         for (int i = 0; i < count; i++)
         {
             TableCell tc = new TableCell();
             ImageButton imgbutton = new ImageButton();
             imgbutton.ImageUrl = "~\\Car\\Front\\" + Path.GetFileName(ds.Tables[0].Rows[i]["CAR_FRONT_IMAGE"].ToString());
             imgbutton.Width = 150;
             imgbutton.Height = 150;
             imgbutton.CssClass = "image-zoom";
             tc.Controls.Add(imgbutton);
             LinkButton lbutton1 = new LinkButton();
             String brand = ds.Tables[0].Rows[i]["CAR_BRAND"].ToString();
             String model = ds.Tables[0].Rows[i]["CAR_MODEL_NAME"].ToString();
             lbutton1.Text = brand + " " + model;
             tc.Controls.Add(lbutton1);
             String carId = ds.Tables[0].Rows[i]["CAR_ID"].ToString();
             String sellerId = ds.Tables[0].Rows[i]["SELLER_ID"].ToString();
             EncryptDecrypt obj1 = new EncryptDecrypt();
             carId = HttpUtility.UrlEncode(obj1.Encrypt(carId));
             sellerId = HttpUtility.UrlEncode(obj1.Encrypt(sellerId));
             lbutton1.PostBackUrl = "CarDetails.aspx?carId=" + carId + "&sellerId=" + sellerId;
             imgbutton.PostBackUrl = "CarDetails.aspx?carId=" + carId + "&sellerId=" + sellerId;
             tc.Attributes.Add("width", "150px");
             tc.Attributes.Add("height", "150px");
             flag++;
             if (flag % 5 != 0)
             {
                 tr.Controls.Add(tc);
             }
             else
             {
                 Table1.Rows.Add(tr);
                 tr = new TableRow();
                 tr.Controls.Add(tc);
             }
         }
         Table1.Rows.Add(tr);
         Table1.CellSpacing = 30;
     }
 }
 protected void LinkButton1_Click(object sender, EventArgs e)
 {
     Panel1.Visible = true;
     int flag = 1;
     DatabaseHandler obj = new DatabaseHandler();
     EncryptDecrypt obj1 = new EncryptDecrypt();
     String sellerId = obj1.Decrypt(HttpUtility.UrlDecode(Request.QueryString["sellerId"].ToString()));
     DataSet ds = obj.GetSellerCars(sellerId);
     if (ds.Tables[0].Rows.Count == 0)
     {
         Label7.Text = "This seller has no car in stock";
         LinkButton1.Visible = false;
     }
     else
     {
         int count1 = ds.Tables[0].Rows.Count;
         TableRow tr = new TableRow();
         for (int i = 0; i < count1; i++)
         {
             LinkButton1.Visible = false;
             TableCell tc = new TableCell();
             Image img = new Image();
             img.ImageUrl = "~\\Car\\Front\\" + Path.GetFileName(ds.Tables[0].Rows[i]["CAR_FRONT_IMAGE"].ToString());
             img.Width = 150;
             img.Height = 150;
             tc.Controls.Add(img);
             LinkButton lbutton1 = new LinkButton();
             String brand = ds.Tables[0].Rows[i]["CAR_BRAND"].ToString();
             String model = ds.Tables[0].Rows[i]["CAR_MODEL_NAME"].ToString();
             lbutton1.Text = brand + " " + model;
             tc.Controls.Add(lbutton1);
             String carId = ds.Tables[0].Rows[i]["CAR_ID"].ToString();
             DataSet ds1 = obj.GetCarSeller(carId);
             carId = HttpUtility.UrlEncode(obj1.Encrypt(carId));
             sellerId = HttpUtility.UrlEncode(obj1.Encrypt(sellerId));
             lbutton1.PostBackUrl = "CarDetails.aspx?carId=" + carId + "&sellerId=" + sellerId;
             tc.Attributes.Add("width", "150px");
             tc.Attributes.Add("height", "150px");
             flag++;
             if (flag % 5 != 0)
                 tr.Controls.Add(tc);
             else
             {
                 Table1.Rows.Add(tr);
                 tr.Controls.Add(tc);
                 tr = new TableRow();
             }
         }
         Table1.Rows.Add(tr);
         Table1.CellSpacing = 30;
     }
 }
 protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     String sellerUsername = Request.Cookies["Car-Trading"]["Username"].ToString();
     DataSet ds = new DataSet();
     DatabaseHandler obj=new DatabaseHandler();
     ds = obj.GetSellerId(sellerUsername);
     String sellerId = ds.Tables[0].Rows[0]["SELLER_ID"].ToString();
     EncryptDecrypt obj1=new EncryptDecrypt();
     sellerId=HttpUtility.UrlEncode(obj1.Encrypt(sellerId));
     String carId=GridView1.SelectedRow.Cells[0].Text;
     carId=HttpUtility.UrlEncode(obj1.Encrypt(carId));
     Response.Redirect("SellerDisplayCarStockInfo.aspx?sellerId=" + sellerId + "&carId=" + carId);
 }
示例#14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin("xabaraCOM");

        if (!IsPostBack)
        {
            myCode.Text = xc.regUserCode();

            EncryptDecrypt ed = new EncryptDecrypt();
            string soft = ed.softName();
            string[] softName = soft.Split(new char[] { '_' });
            soft = softName[0];
            softLink.NavigateUrl = "http://www.zdianpu.com/soft/" + soft + "/server.aspx";
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     EncryptDecrypt obj1=new EncryptDecrypt();
     String sellerId=obj1.Decrypt(HttpUtility.UrlDecode(Request.QueryString["sellerId"].ToString()));
     DatabaseHandler obj = new DatabaseHandler();
     DataSet ds = obj.GetSellerInfo(sellerId);
     Label1.Text = ds.Tables[0].Rows[0]["SELLER_NAME"].ToString();
     Label2.Text = ds.Tables[0].Rows[0]["SELLER_COUNTRY"].ToString();
     Label3.Text = ds.Tables[0].Rows[0]["SELLER_CITY"].ToString();
     Label4.Text = ds.Tables[0].Rows[0]["SELLER_STREET"].ToString();
     Label5.Text = ds.Tables[0].Rows[0]["SELLER_PHONE_NUMBER"].ToString();
     Label6.Text = ds.Tables[0].Rows[0]["SELLER_EMAIL_ID"].ToString();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     EncryptDecrypt obj=new EncryptDecrypt();
     String sellerId = obj.Decrypt(HttpUtility.UrlDecode(Request.QueryString["sellerId"].ToString()));
     String carId = obj.Decrypt(HttpUtility.UrlDecode(Request.QueryString["carId"].ToString()));
     DatabaseHandler obj1 = new DatabaseHandler();
     DataSet ds = obj1.GetCarInfo(carId);
     Label1.Text = ds.Tables[0].Rows[0]["CAR_BRAND"].ToString();
     Label2.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NAME"].ToString();
     Label3.Text = ds.Tables[0].Rows[0]["CAR_MODEL_NUMBER"].ToString();
     Label4.Text = ds.Tables[0].Rows[0]["CAR_POSSESSION_TYPE"].ToString();
     Label5.Text = ds.Tables[0].Rows[0]["CAR_YEAR_OF_PURCHASE"].ToString();
     Label6.Text = ds.Tables[0].Rows[0]["CAR_PRICE"].ToString();
     Label7.Text = ds.Tables[0].Rows[0]["CAR_ENGINE"].ToString();
     Label8.Text = ds.Tables[0].Rows[0]["CAR_FUEL"].ToString();
     Label9.Text = ds.Tables[0].Rows[0]["CAR_STOCK_QUANTITY"].ToString();
 }
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     String sellerId = null;
     try
     {
         Response.Redirect("SellerEditInfo.aspx?sellerId=" + Request.QueryString["sellerId"].ToString());
     }
     catch (System.NullReferenceException exc)
     {
         String sellerUsername = Request.Cookies["Car-Trading"]["Username"].ToString();
         DatabaseHandler x = new DatabaseHandler();
         DataSet ds1 = x.GetSellerId(sellerUsername);
         sellerId = ds1.Tables[0].Rows[0]["SELLER_ID"].ToString();
         EncryptDecrypt obj = new EncryptDecrypt();
         sellerId = HttpUtility.UrlEncode(obj.Encrypt(sellerId));
         Response.Redirect("SellerEditInfo.aspx?sellerId=" + sellerId);
     }
 }
示例#18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        xc.CheckAdminLogin("xabaraCOM");
        if (!IsPostBack)
        {
            EncryptDecrypt ed = new EncryptDecrypt();
            soft = ed.softName();
            string[] softName = soft.Split(new char[] { '_' });
            soft = softName[0];

            string pathFlie = Server.MapPath("/xabara.config");
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(pathFlie);

            taobaoKeAppKey.Text = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='taobaoKeAppKey']").Attributes["value"].Value;
            taobaoKeAppSecret.Text = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='taobaoKeAppSecret']").Attributes["value"].Value;
            taobaoKeAlimamaID.Text = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='taobaoKeAlimamaID']").Attributes["value"].Value;
            hotSearch.Text = xmlDoc.DocumentElement.SelectSingleNode("//add[@key='hotSearch']").Attributes["value"].Value;

            xmlDoc = null;
        }
    }
 protected void Page_Load(object sender, EventArgs e)
 {
     this.UnobtrusiveValidationMode = System.Web.UI.UnobtrusiveValidationMode.None;
     if (!checkCookie())
         Response.Redirect("Login.aspx");
     String sellerId = Request.QueryString["sellerId"].ToString();
     EncryptDecrypt obj = new EncryptDecrypt();
     sellerId = obj.Decrypt(HttpUtility.UrlDecode(sellerId));
     DatabaseHandler obj1 = new DatabaseHandler();
     DataSet ds = new DataSet();
     ds = obj1.GetSellerHomeInfo(sellerId);
     TextBox1.Text = ds.Tables[0].Rows[0]["SELLER_NAME"].ToString();
     TextBox2.Text = ds.Tables[0].Rows[0]["SELLER_COUNTRY"].ToString();
     TextBox3.Text = ds.Tables[0].Rows[0]["SELLER_CITY"].ToString();
     TextBox4.Text = ds.Tables[0].Rows[0]["SELLER_STREET"].ToString();
     TextBox5.Text = ds.Tables[0].Rows[0]["SELLER_PHONE_NUMBER"].ToString();
     TextBox6.Text = ds.Tables[0].Rows[0]["SELLER_EMAIL_ID"].ToString();
     TextBox7.Text = ds.Tables[0].Rows[0]["SELLER_BANK"].ToString();
     TextBox8.Text = ds.Tables[0].Rows[0]["SELLER_BANK_ACCOUNT_NUMBER"].ToString();
     TextBox9.Attributes.Add("value", ds.Tables[0].Rows[0]["SELLER_PASSWORD"].ToString());
     Image1.ImageUrl = "~\\Seller ID\\" + Path.GetFileName(ds.Tables[0].Rows[0]["SELLER_ID_PROOF"].ToString());
     Image1.Width = 100;
     Image1.Height = 100;
 }
示例#20
0
        public List <MentalHealthClientList> LoadMentalHealthDashboardList(string centerid, string mode)
        {
            List <MentalHealthClientList> clientList = new List <MentalHealthClientList>();
            Roster _roster = new Roster();

            try
            {
                StaffDetails inst = StaffDetails.GetInstance();
                command.Parameters.Clear();
                command.Parameters.Add(new SqlParameter("@CenterId", EncryptDecrypt.Decrypt64(centerid)));
                command.Parameters.Add(new SqlParameter("@userid", inst.UserId));
                command.Parameters.Add(new SqlParameter("@agencyid", inst.AgencyId));
                command.Parameters.Add(new SqlParameter("@Mode", mode));
                command.Connection  = Connection;
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "SP_LoadMentalHealthList";
                DataAdapter         = new SqlDataAdapter(command);
                _dataset            = new DataSet();
                DataAdapter.Fill(_dataset);
                if (_dataset.Tables[0] != null)
                {
                    if (_dataset.Tables[0].Rows.Count > 0)
                    {
                        MentalHealthClientList info = null;
                        foreach (DataRow dr in _dataset.Tables[0].Rows)
                        {
                            info               = new MentalHealthClientList();
                            info.Householid    = dr["Householdid"].ToString();
                            info.Eclientid     = EncryptDecrypt.Encrypt64(dr["Clientid"].ToString());
                            info.EHouseholid   = EncryptDecrypt.Encrypt64(dr["Householdid"].ToString());
                            info.Name          = dr["name"].ToString();
                            info.DOB           = Convert.ToString(dr["dob"]);
                            info.Gender        = dr["gender"].ToString();
                            info.CenterName    = dr["CenterName"].ToString();
                            info.CenterId      = EncryptDecrypt.Encrypt64(dr["CenterId"].ToString());
                            info.YakkrId       = EncryptDecrypt.Encrypt64(dr["YakkrId"].ToString());
                            info.ProgramId     = EncryptDecrypt.Encrypt64(dr["programid"].ToString());
                            info.ClassroomName = dr["ClassroomName"].ToString();
                            info.FSW           = dr["fswname"].ToString();
                            info.Picture       = dr["ProfilePic"].ToString() == "" ? "" : Convert.ToBase64String((byte[])dr["ProfilePic"]);
                            info.classroomid   = dr["classroomid"].ToString();
                            clientList.Add(info);
                        }
                    }
                }


                //End
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
            }
            finally
            {
                if (Connection != null)
                {
                    Connection.Close();
                }
            }
            return(clientList);
        }
示例#21
0
    protected void ButtonUpload_Click(object sender, EventArgs e)
    {
        string NamaFile    = Path.GetFileNameWithoutExtension(FileUploadTransferBahanBaku.FileName);
        string ExtensiFile = Path.GetExtension(FileUploadTransferBahanBaku.FileName);

        #region Format import harus .zip
        if (ExtensiFile != ".zip")
        {
            LiteralWarning.Text = Alert_Class.Pesan(TipeAlert.Danger, "Format import harus .zip");
            return;
        }
        #endregion

        if (FileUploadTransferBahanBaku.HasFile)
        {
            string Folder = Server.MapPath("~/Files/Transfer Bahan Baku/Penerimaan/");

            if (!Directory.Exists(Folder))
            {
                Directory.CreateDirectory(Folder);
            }

            string LokasiFile = Folder + NamaFile + ExtensiFile;
            string Output     = Folder + NamaFile + "_dec" + ExtensiFile;

            FileUploadTransferBahanBaku.SaveAs(LokasiFile);

            EncryptDecrypt.Decrypt(LokasiFile, Output);

            string file = File.ReadAllText(Output);

            File.Delete(Output);

            var FileTransferBahanBaku = JsonConvert.DeserializeObject <FileTransferBahanBaku>(file);

            using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext())
            {
                #region Transfer transfer sudah terdaftar
                if (db.TBTransferBahanBakus.FirstOrDefault(item => item.IDTransferBahanBaku == FileTransferBahanBaku.IDTransferBahanBaku) != null)
                {
                    LiteralWarning.Text = Alert_Class.Pesan(TipeAlert.Danger, "Data Transfer sudah terdaftar");
                    return;
                }
                #endregion

                Tempat_Class            ClassTempat             = new Tempat_Class(db);
                BahanBaku_Class         ClassBahanBaku          = new BahanBaku_Class();
                KategoriBahanBaku_Class KategoriBahanBaku_Class = new KategoriBahanBaku_Class();

                PenggunaLogin Pengguna = (PenggunaLogin)Session["PenggunaLogin"];

                #region TEMPAT PENERIMA
                var TempatPenerima = ClassTempat.Cari(FileTransferBahanBaku.FileTempatPenerima.IDWMS);

                if (TempatPenerima == null)
                {
                    TempatPenerima = new TBTempat
                    {
                        Alamat                   = FileTransferBahanBaku.FileTempatPenerima.Alamat,
                        BiayaTambahan1           = FileTransferBahanBaku.FileTempatPenerima.BiayaTambahan1,
                        BiayaTambahan2           = FileTransferBahanBaku.FileTempatPenerima.BiayaTambahan2,
                        BiayaTambahan3           = FileTransferBahanBaku.FileTempatPenerima.BiayaTambahan3,
                        BiayaTambahan4           = FileTransferBahanBaku.FileTempatPenerima.BiayaTambahan4,
                        Email                    = FileTransferBahanBaku.FileTempatPenerima.Email,
                        EnumBiayaTambahan1       = FileTransferBahanBaku.FileTempatPenerima.EnumBiayaTambahan1,
                        EnumBiayaTambahan2       = FileTransferBahanBaku.FileTempatPenerima.EnumBiayaTambahan2,
                        EnumBiayaTambahan3       = FileTransferBahanBaku.FileTempatPenerima.EnumBiayaTambahan3,
                        EnumBiayaTambahan4       = FileTransferBahanBaku.FileTempatPenerima.EnumBiayaTambahan4,
                        FooterPrint              = FileTransferBahanBaku.FileTempatPenerima.FooterPrint,
                        IDKategoriTempat         = FileTransferBahanBaku.FileTempatPenerima.IDKategoriTempat,
                        IDStore                  = FileTransferBahanBaku.FileTempatPenerima.IDStore,
                        _IDWMS                   = FileTransferBahanBaku.FileTempatPenerima.IDWMS,
                        KeteranganBiayaTambahan1 = FileTransferBahanBaku.FileTempatPenerima.KeteranganBiayaTambahan1,
                        KeteranganBiayaTambahan2 = FileTransferBahanBaku.FileTempatPenerima.KeteranganBiayaTambahan2,
                        KeteranganBiayaTambahan3 = FileTransferBahanBaku.FileTempatPenerima.KeteranganBiayaTambahan3,
                        KeteranganBiayaTambahan4 = FileTransferBahanBaku.FileTempatPenerima.KeteranganBiayaTambahan4,
                        Kode           = FileTransferBahanBaku.FileTempatPenerima.Kode,
                        Latitude       = FileTransferBahanBaku.FileTempatPenerima.Latitude,
                        Longitude      = FileTransferBahanBaku.FileTempatPenerima.Longitude,
                        Nama           = FileTransferBahanBaku.FileTempatPenerima.Nama,
                        _TanggalInsert = FileTransferBahanBaku.FileTempatPenerima.TanggalDaftar,
                        _TanggalUpdate = FileTransferBahanBaku.FileTempatPenerima.TanggalUpdate,
                        Telepon1       = FileTransferBahanBaku.FileTempatPenerima.Telepon1,
                        Telepon2       = FileTransferBahanBaku.FileTempatPenerima.Telepon2
                    };

                    db.TBTempats.InsertOnSubmit(TempatPenerima);
                    db.SubmitChanges();
                }
                #endregion

                //MASTER DATA
                foreach (var item in FileTransferBahanBaku.TransferBahanBakuDetails)
                {
                    #region BAHAN BAKU
                    var BahanBaku = ClassBahanBaku.Cari(db, item.BahanBaku);

                    if (BahanBaku == null)
                    {
                        BahanBaku = ClassBahanBaku.Tambah(db, item.SatuanKecil, item.SatuanBesar, item.BahanBaku, item.Konversi);
                    }
                    else
                    {
                        BahanBaku = ClassBahanBaku.Ubah(db, BahanBaku, item.SatuanKecil, item.SatuanBesar, item.Konversi);
                    }
                    #endregion

                    #region KATEGORI
                    KategoriBahanBaku_Class.KategoriBahanBaku(db, BahanBaku, item.Kategori);
                    #endregion

                    #region STOK BAHAN BAKU
                    var stokBahanBaku = db.TBStokBahanBakus.FirstOrDefault(data => data.IDBahanBaku == BahanBaku.IDBahanBaku && data.IDTempat == TempatPenerima.IDTempat);

                    if (stokBahanBaku == null)
                    {
                        stokBahanBaku = StokBahanBaku_Class.InsertStokBahanBaku(db, DateTime.Now, Pengguna.IDPengguna, TempatPenerima.IDTempat, BahanBaku, (item.HargaBeli / item.Konversi), 0, 0, "");
                    }
                    else
                    {
                        stokBahanBaku.HargaBeli = item.HargaBeli;
                    }
                    #endregion

                    db.SubmitChanges();
                }

                #region TEMPAT PENGIRIM
                var TempatPengirim = ClassTempat.Cari(FileTransferBahanBaku.FileTempatPengirim.IDWMS);

                if (TempatPengirim == null)
                {
                    TempatPengirim = new TBTempat
                    {
                        Alamat                   = FileTransferBahanBaku.FileTempatPengirim.Alamat,
                        BiayaTambahan1           = FileTransferBahanBaku.FileTempatPengirim.BiayaTambahan1,
                        BiayaTambahan2           = FileTransferBahanBaku.FileTempatPengirim.BiayaTambahan2,
                        BiayaTambahan3           = FileTransferBahanBaku.FileTempatPengirim.BiayaTambahan3,
                        BiayaTambahan4           = FileTransferBahanBaku.FileTempatPengirim.BiayaTambahan4,
                        Email                    = FileTransferBahanBaku.FileTempatPengirim.Email,
                        EnumBiayaTambahan1       = FileTransferBahanBaku.FileTempatPengirim.EnumBiayaTambahan1,
                        EnumBiayaTambahan2       = FileTransferBahanBaku.FileTempatPengirim.EnumBiayaTambahan2,
                        EnumBiayaTambahan3       = FileTransferBahanBaku.FileTempatPengirim.EnumBiayaTambahan3,
                        EnumBiayaTambahan4       = FileTransferBahanBaku.FileTempatPengirim.EnumBiayaTambahan4,
                        FooterPrint              = FileTransferBahanBaku.FileTempatPengirim.FooterPrint,
                        IDKategoriTempat         = FileTransferBahanBaku.FileTempatPengirim.IDKategoriTempat,
                        IDStore                  = FileTransferBahanBaku.FileTempatPengirim.IDStore,
                        _IDWMS                   = FileTransferBahanBaku.FileTempatPengirim.IDWMS,
                        KeteranganBiayaTambahan1 = FileTransferBahanBaku.FileTempatPengirim.KeteranganBiayaTambahan1,
                        KeteranganBiayaTambahan2 = FileTransferBahanBaku.FileTempatPengirim.KeteranganBiayaTambahan2,
                        KeteranganBiayaTambahan3 = FileTransferBahanBaku.FileTempatPengirim.KeteranganBiayaTambahan3,
                        KeteranganBiayaTambahan4 = FileTransferBahanBaku.FileTempatPengirim.KeteranganBiayaTambahan4,
                        Kode           = FileTransferBahanBaku.FileTempatPengirim.Kode,
                        Latitude       = FileTransferBahanBaku.FileTempatPengirim.Latitude,
                        Longitude      = FileTransferBahanBaku.FileTempatPengirim.Longitude,
                        Nama           = FileTransferBahanBaku.FileTempatPengirim.Nama,
                        _TanggalInsert = FileTransferBahanBaku.FileTempatPengirim.TanggalDaftar,
                        _TanggalUpdate = FileTransferBahanBaku.FileTempatPengirim.TanggalUpdate,
                        Telepon1       = FileTransferBahanBaku.FileTempatPengirim.Telepon1,
                        Telepon2       = FileTransferBahanBaku.FileTempatPengirim.Telepon2
                    };
                }
                #endregion

                #region PENGGUNA PENGIRIM
                var PenggunaPengirim = db.TBPenggunas
                                       .FirstOrDefault(item => item.Username.ToLower() == FileTransferBahanBaku.FilePenggunaPengirim.Username.ToLower());

                if (PenggunaPengirim == null)
                {
                    //PENGGUNA PENGIRIM
                    PenggunaPengirim = new TBPengguna
                    {
                        IDGrupPengguna    = FileTransferBahanBaku.FilePenggunaPengirim.IDGrupPengguna,
                        NamaLengkap       = FileTransferBahanBaku.FilePenggunaPengirim.NamaLengkap,
                        Username          = FileTransferBahanBaku.FilePenggunaPengirim.Username,
                        Password          = FileTransferBahanBaku.FilePenggunaPengirim.Password,
                        PIN               = FileTransferBahanBaku.FilePenggunaPengirim.PIN,
                        _IsActive         = FileTransferBahanBaku.FilePenggunaPengirim.Status,
                        TBTempat          = TempatPengirim,
                        TanggalLahir      = DateTime.Now,
                        _IDWMS            = Guid.NewGuid(),
                        TanggalBekerja    = DateTime.Now,
                        _TanggalInsert    = DateTime.Now,
                        _IDTempatInsert   = TempatPenerima.IDTempat,
                        _IDPenggunaInsert = Pengguna.IDTempat,
                        _TanggalUpdate    = DateTime.Now,
                        _IDTempatUpdate   = TempatPenerima.IDTempat,
                        _IDPenggunaUpdate = Pengguna.IDTempat
                    };
                }
                #endregion

                #region TRANSFER BAHAN BAKU
                TBTransferBahanBaku TransferBahanBaku = new TBTransferBahanBaku
                {
                    IDTransferBahanBaku = FileTransferBahanBaku.IDTransferBahanBaku,
                    //Nomor
                    TBPengguna = PenggunaPengirim,
                    //IDPenerima
                    TBTempat          = TempatPengirim,
                    IDTempatPenerima  = TempatPenerima.IDTempat,
                    TanggalDaftar     = FileTransferBahanBaku.TanggalDaftar,
                    TanggalUpdate     = FileTransferBahanBaku.TanggalUpdate,
                    EnumJenisTransfer = FileTransferBahanBaku.EnumJenisTransfer,
                    TanggalKirim      = FileTransferBahanBaku.TanggalKirim,
                    //TanggalTerima
                    TotalJumlah = FileTransferBahanBaku.TotalJumlah,
                    GrandTotal  = FileTransferBahanBaku.GrandTotal,
                    Keterangan  = FileTransferBahanBaku.Keterangan
                };
                #endregion

                #region DETAIL TRANSFER BAHAN BAKU
                foreach (var item in FileTransferBahanBaku.TransferBahanBakuDetails)
                {
                    var BahanBaku = db.TBBahanBakus.FirstOrDefault(data => data.Nama.ToLower() == item.BahanBaku.ToLower());

                    TransferBahanBaku.TBTransferBahanBakuDetails.Add(new TBTransferBahanBakuDetail
                    {
                        //IDTransferBahanBakuDetail
                        //IDTransferBahanBaku
                        TBBahanBaku = BahanBaku,
                        TBSatuan    = BahanBaku.TBSatuan1,
                        HargaBeli   = item.HargaBeli,
                        Jumlah      = item.Jumlah
                                      //Subtotal
                    });
                }
                #endregion

                db.TBTransferBahanBakus.InsertOnSubmit(TransferBahanBaku);
                db.SubmitChanges();

                if (TransferBahanBaku.IDTempatPenerima == Pengguna.IDTempat)
                {
                    Response.Redirect("Pengaturan.aspx?id=" + TransferBahanBaku.IDTransferBahanBaku);
                }
                else
                {
                    Response.Redirect("Default.aspx");
                }
            }
        }
    }
示例#22
0
        private void button_add_Click(object sender, EventArgs e)
        {
            //Getting Values from UI
            int UserID = 0;

            //Get UserID from textbox if the row is selected
            if (textBox_UserID.Text.Trim() != "")
            {
                UserID = int.Parse(textBox_UserID.Text.Trim());
            }
            string FullName = textBox_fullname.Text.Trim();
            string Email    = textBox_email.Text.Trim();
            string Username = textBox_username.Text.Trim();
            string Password = textBox_password.Text.Trim();

            //Encrypt Password
            Password = EncryptDecrypt.Encrypt(Password);
            string Contact  = textBox_contact.Text.Trim();
            string Address  = textBox_address.Text.Trim();
            string UserType = comboBox_usertype.Text.Trim();
            string Gender   = comboBox_Gender.Text.Trim();


            //Declare and Assign/Initialize Object
            //Here Left Side Variable from User Class
            //And Right Side From Above Variables
            User U = new User();

            U.UserID   = UserID;
            U.FullName = FullName;
            U.Email    = Email;
            U.Username = Username;
            U.Password = Password;
            U.Contact  = Contact;
            U.Address  = Address;
            U.UserType = UserType;
            U.Gender   = Gender;
            //how to add radio gender

            //create Object for UserDAL
            UserDAL dal = new UserDAL();

            //Identify the Case for Insert or Update
            if (U.UserID == 0)
            {
                //Case For Insert
                bool success = dal.Insert_User(U);
                if (success == true)
                {
                    MessageBox.Show("New User Successfully Added. Thank You.");
                    //AfterSaving Successfully, redirecting form to User List
                }
                else
                {
                    MessageBox.Show("Failed to Insert User. Try Again");
                }
            }
            else
            {
                //Case For Update
                bool success = dal.Update_User(U);
                if (success == true)
                {
                    //Show Messsage to display success message
                    MessageBox.Show("User Successfully updated. Thank You.");
                    //After Successfully Updating User, Refreshing the Datagrid view
                    DataTable dt = dal.Select_User();
                    dataGridView_userlist.DataSource = dt;
                }
                else
                {
                    //Show Error Message
                    MessageBox.Show("Failed tp Update User. Try Again.");
                }
            }
        }
示例#23
0
        public ScreeningAnalysisInfoModel ScreeningInfo(ScreeningAnalysisInfo info)
        {
            ScreeningAnalysisInfoModel   model             = new ScreeningAnalysisInfoModel();
            List <ScreeningAnalysisInfo> screeningInfoList = new List <ScreeningAnalysisInfo>();

            //  try
            //  {
            if (Connection.State == ConnectionState.Open)
            {
                Connection.Close();
            }
            Connection.Open();
            command.Parameters.Clear();
            command.Parameters.Add(new SqlParameter("@AgencyId", info.AgencyId));
            command.Parameters.Add(new SqlParameter("@Center", info.CenterId));
            command.Parameters.Add(new SqlParameter("@ClassRoom", info.ClassRoomId));
            command.Parameters.Add(new SqlParameter("@Filter", info.FilterType));
            command.Connection  = Connection;
            command.CommandType = CommandType.StoredProcedure;
            command.CommandText = "EducationManagerScreening";
            _dataset            = new DataSet();
            DataAdapter         = new SqlDataAdapter(command);
            DataAdapter.Fill(_dataset);
            if (_dataset != null)
            {
                if (_dataset.Tables[0].Rows.Count > 0)
                {
                    screeningInfoList = (from DataRow dr in _dataset.Tables[0].Rows
                                         select new ScreeningAnalysisInfo
                    {
                        ClientId = Convert.ToInt64(dr["clientId"]),
                        ChildName = dr["childname"].ToString(),
                        CenterId = Convert.ToInt64(dr["centerid"]),
                        ClassRoomId = Convert.ToInt64(dr["classroomid"]),
                        CenterName = dr["centername"].ToString(),
                        ClassroomName = dr["classroomname"].ToString(),
                        NumofDaysScreening = dr["numofdaysscreening"].ToString(),
                        ScreeningDate = dr["screeningdate"].ToString(),
                        DateofFirstService = dr["dateoffirstservice"].ToString(),
                        ScreeningResults = dr["screeningresults"].ToString(),
                        RescreenNumofDaysScreening = dr["numofdaysrescreen"].ToString(),
                        RescreenDate = dr["rescreeningdate"].ToString(),
                        RescreenResults = dr["rescreeningresults"].ToString(),
                        dob = dr["dob"].ToString()
                    }

                                         ).ToList();
                }

                if (_dataset.Tables.Count == 2)
                {
                    if (_dataset.Tables[1].Rows.Count > 0)
                    {
                        model.CenterList = (from DataRow dr1 in _dataset.Tables[1].Rows
                                            select new Center
                        {
                            CenterId = Convert.ToInt32(dr1["CenterId"]),
                            CenterName = dr1["CenterName"].ToString(),
                            Enc_CenterId = EncryptDecrypt.Encrypt64(dr1["CenterId"].ToString())
                        }
                                            ).ToList();
                    }
                }



                model.ScreeningAnalysisInfoList = screeningInfoList;
            }
            //    }
            //    catch (Exception ex)
            //    {
            //         clsError.WriteException(ex);
            //     }
            return(model);
        }
示例#24
0
        public void BindQueueID()
        {
            try
            {
                //EncryptDecrypt.Encrypt("rpa_tst_prtl_1");
                //EncryptDecrypt.Encrypt("yT4tTZTa");
                var queueData = dbHelper.BindQueueID();
                if (queueData.Rows.Count > 0)
                {
                    foreach (DataRow oRow in queueData.Rows)
                    {
                        queueID = oRow["Process_Queue_ID"].ToString();

                        string url = Assets.EndPoint + queueID; //"4217";

                        HttpClient client = new HttpClient(new HttpClientHandler()
                        {
                            Credentials = new NetworkCredential()
                            {
                                UserName = EncryptDecrypt.Decrypt(Assets.NUID),
                                Password = EncryptDecrypt.Decrypt(Assets.NUID_Password),
                                Domain   = Assets.Domain
                            }
                        })
                        {
                            BaseAddress = new Uri(url)
                        };

                        HttpResponseMessage response = client.GetAsync(url).Result;

                        var dt = CreateTable();

                        if (response.IsSuccessStatusCode)
                        {
                            var httpResponseResult = response.Content.ReadAsStringAsync().Result;
                            var data = JObject.Parse(httpResponseResult);

                            var list = data["value"].ToList();

                            foreach (var item in list)
                            {
                                string qID    = item["QueueDefinitionId"].ToString();
                                string status = item["Status"].ToString();
                                string Key    = item["Key"].ToString();
                                string ProcessingExceptionType = item["ProcessingExceptionType"].ToString();
                                string StartProcessing         = item["StartProcessing"].ToString();
                                string EndProcessing           = item["EndProcessing"].ToString();
                                string Id = item["Id"].ToString();

                                dt.Rows.Add(Id, Key, qID, StartProcessing, EndProcessing, status, ProcessingExceptionType);
                            }
                            dbHelper.UpdateTable(dt);
                        }
                    }
                    var a = mail.Send(Assets.Mail_From, Assets.Mail_To, Assets.Mail_Subject, Assets.Mail_Body);
                }
            }
            catch (Exception ex)
            {
                dbHelper.ErrorLogging(queueID, ex.Message, "Application", ex.StackTrace, Assets.ProcessName, _identity);
            }
        }
示例#25
0
        public FingerprintsModel.Login LoginUser(out string result, out List <Role> RoleList, string UserName, string Password, string IPaddress)
        {
            //string Pwd = EncryptDecrypt.Decrypt(Password);
            Login Login = null;

            result   = string.Empty;
            RoleList = new List <Role>();
            try
            {
                Command.Parameters.Add(new SqlParameter("@emailid", UserName));
                Command.Parameters.Add(new SqlParameter("@password", EncryptDecrypt.Encrypt(Password)));
                Command.Parameters.Add(new SqlParameter("@IPaddress", IPaddress));
                Command.Parameters.Add(new SqlParameter("@result", SqlDbType.VarChar, 100)).Direction = ParameterDirection.Output;
                Command.Connection  = Connection;
                Command.CommandType = CommandType.StoredProcedure;
                Command.CommandText = "LOGINDETAILS";
                DataAdapter         = new SqlDataAdapter(Command);
                _Dataset            = new DataSet();
                DataAdapter.Fill(_Dataset);
                result = Command.Parameters["@result"].Value.ToString();
                if (result.ToLower().Contains("success"))
                {
                    if (_Dataset != null && _Dataset.Tables[0] != null && _Dataset.Tables[0].Rows.Count > 0)
                    {
                        Login            = new Login();
                        Login.UserId     = Guid.Parse(Convert.ToString(_Dataset.Tables[0].Rows[0]["userid"]));
                        Login.RoleName   = Convert.ToString(_Dataset.Tables[0].Rows[0]["RoleName"]);
                        Login.Emailid    = Convert.ToString(_Dataset.Tables[0].Rows[0]["Emailid"]);
                        Login.UserName   = Convert.ToString(_Dataset.Tables[0].Rows[0]["name"]);
                        Login.roleId     = Guid.Parse(_Dataset.Tables[0].Rows[0]["Roleid"].ToString());
                        Login.MenuEnable = Convert.ToBoolean(_Dataset.Tables[0].Rows[0]["MenuEnabled"].ToString());
                        if (!string.IsNullOrEmpty(_Dataset.Tables[0].Rows[0]["AgencyId"].ToString()))
                        {
                            Login.AgencyId = Guid.Parse(_Dataset.Tables[0].Rows[0]["AgencyId"].ToString());
                        }
                        else
                        {
                            Login.AgencyId = null;
                        }
                    }
                    if (_Dataset != null && _Dataset.Tables.Count > 1 && _Dataset.Tables[1] != null && _Dataset.Tables[1].Rows.Count > 0)
                    {
                        Role info = new Role();
                        foreach (DataRow dr in _Dataset.Tables[1].Rows)
                        {
                            info             = new Role();
                            info.RoleId      = dr["Roleid"].ToString();
                            info.RoleName    = dr["rolename"].ToString();
                            info.Defaultrole = Convert.ToBoolean(dr["defualtrole"]);
                            RoleList.Add(info);
                        }
                    }
                }
                return(Login);
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
                if (Connection != null)
                {
                    Connection.Close();
                }
                return(Login);
            }
            finally
            {
                if (Connection != null)
                {
                    Connection.Close();
                }
            }
        }
示例#26
0
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (Session["PSEEMAIL"].ToString() != "" && Session["PSEName"].ToString() != "")
            {
                this.Master.ErrorMessage = this.Title;
                ds    = new DataSet();
                w     = Request.QueryString["memid"].ToString();
                ency  = new EncryptDecrypt();
                MemID = ency.EncryptDecryptString("£", Request.QueryString["memid"].ToString());

                string     s   = Session["PSEName"].ToString();
                string     id  = Session["PSMEID"].ToString();
                SqlCommand cmd = new SqlCommand("select * from [tblMerchantReg] where [MemID]='" + MemID + "'", con);
                cmd.CommandType = CommandType.Text;
                SqlDataAdapter da = new SqlDataAdapter(cmd);
                da.Fill(ds);
                da.Dispose();
                lblError.Visible = false;
                if (!Page.IsPostBack)
                {
                    //code for selecting industry
                    BA_Marketing mar          = new BA_Marketing();
                    BA_postjobs  pst2         = new BA_postjobs();
                    DataSet      dsindustries = new DataSet();;
                    dsindustries              = mar.fillcategory();
                    ddIndustry.DataSource     = dsindustries;
                    ddIndustry.DataTextField  = "indusname";
                    ddIndustry.DataValueField = "ID";
                    ddIndustry.DataBind();
                    ddIndustry.Items.Insert(0, new ListItem("--Select--", "--Select--"));
                    ddlcbIndustry.DataSource     = dsindustries;
                    ddlcbIndustry.DataTextField  = "indusname";
                    ddlcbIndustry.DataValueField = "indusname";
                    ddlcbIndustry.DataBind();
                    DataTable     dt  = dsindustries.Tables[0];
                    List <string> lst = new List <string>();

                    //  ddlcbIndustry.Items.Insert(0, new ListItem("--Select--", "--Select--"));

                    //code for  selecting experience fro &to
                    ddlmax.Items.Insert(0, new ListItem("Max", "Max"));
                    ddlmin.Items.Insert(0, new ListItem("Min", "Min"));
                    for (int i = 0; i <= 10; i++)
                    {
                        ddlmax.Items.Add(i.ToString());
                        ddlmin.Items.Add(i.ToString());
                    }

                    //code for selecting location
                    DataSet dslocations = new DataSet();;
                    dslocations                = pst2.getLocations();
                    ddlLocation.DataSource     = dslocations;
                    ddlLocation.DataTextField  = "PreLoc";
                    ddlLocation.DataValueField = "PreLoc";
                    ddlLocation.DataBind();
                    ddlLocation.Items.Insert(0, new ListItem("--Select--", "--Select--"));
                    ddlLocation.Items.Insert(1, new ListItem("--OTHER--", "--OTHER--"));
                    //code for jobtype
                    //ddlJobType.Items.Insert(0, new ListItem("--Select--", "--Select--"));
                    //ddlJobType.Items.Add("Permanent");
                    //ddlJobType.Items.Add("Contract");
                    //code for Binding Repeater
                    // BindRepeater();
                }
            }
            else
            {
                Response.Redirect("~/employlogin.aspx", false);
            }
        }
        catch (Exception ex)
        {
            Response.Redirect("~/employlogin.aspx", false);
        }
    }
    private static void LoadSettings()
    {
      using (Settings xmlreader = new MPSettings())
      {
        username = xmlreader.GetValueAsString("audioscrobbler", "user", String.Empty);
        _recordToProfile = xmlreader.GetValueAsBool("audioscrobbler", "submitradiotracks", true);
        _artistPrefixes = xmlreader.GetValueAsString("musicfiles", "artistprefixes", "The, Les, Die");
        _artistsStripped = xmlreader.GetValueAsBool("musicfiles", "stripartistprefixes", false);
        _getLastfmCover = xmlreader.GetValueAsBool("musicmisc", "fetchlastfmcovers", true);
        _switchArtist = xmlreader.GetValueAsBool("musicmisc", "switchArtistOnLastFMSubmit", false);

        string tmpPass;

        tmpPass =
          MusicDatabase.Instance.AddScrobbleUserPassword(
            Convert.ToString(MusicDatabase.Instance.AddScrobbleUser(username)), String.Empty);
        _useDebugLog =
          (MusicDatabase.Instance.AddScrobbleUserSettings(
            Convert.ToString(MusicDatabase.Instance.AddScrobbleUser(username)), "iDebugLog", -1) == 1)
            ? true
            : false;

        if (tmpPass != string.Empty)
        {
          try
          {
            EncryptDecrypt Crypter = new EncryptDecrypt();
            password = Crypter.Decrypt(tmpPass);
          }
          catch (Exception ex)
          {
            Log.Error("Audioscrobbler: Password decryption failed {0}", ex.Message);
          }
        }
      }

      queue = new AudioscrobblerQueue(Config.GetFile(Config.Dir.Database, "LastFmCache-" + Username + ".xml"));

      queueLock = new Object();
      submitLock = new Object();

      lastHandshake = DateTime.MinValue;
      handshakeInterval = new TimeSpan(0, HANDSHAKE_INTERVAL, 0);
      handshakeRadioInterval = new TimeSpan(0, 5 * HANDSHAKE_INTERVAL, 0);
      // Radio is session based - no need to re-handshake soon
      lastConnectAttempt = DateTime.MinValue;
      minConnectWaitTime = new TimeSpan(0, 0, CONNECT_WAIT_TIME);
      _cookies = new CookieContainer();
      _radioStreamLocation = string.Empty;
      _radioSession = string.Empty;
      _subscriber = false;
      _currentSong = new Song();
      _currentPostSong = new Song();
    }
 public static void SaveRegistryWithSubKey(string title, string subTitle, string keyName, string keyValue, EncryptionOptionsWithSubKey encryptionOptions, string encryptionKey = "123") //Save a value to Reg
 {
     if (EncryptionOptionsWithSubKey.NoEncryption == encryptionOptions)
     {
         RegistryKey Test = Registry.CurrentUser.CreateSubKey(title + "\\" + subTitle);
         Test.SetValue(keyName, keyValue);
     }
     else if (EncryptionOptionsWithSubKey.FullEncryption == encryptionOptions)
     {
         RegistryKey Test = Registry.CurrentUser.CreateSubKey(EncryptDecrypt.Encrypt(title, encryptionKey) + "\\" + EncryptDecrypt.Encrypt(subTitle, encryptionKey));
         Test.SetValue(EncryptDecrypt.Encrypt(keyName, encryptionKey), EncryptDecrypt.Encrypt(keyValue, encryptionKey));
     }
     else if (EncryptionOptionsWithSubKey.SubKeyAndValue == encryptionOptions)
     {
         RegistryKey Test = Registry.CurrentUser.CreateSubKey(title + "\\" + EncryptDecrypt.Encrypt(subTitle, encryptionKey));
         Test.SetValue(EncryptDecrypt.Encrypt(keyName, encryptionKey), EncryptDecrypt.Encrypt(keyValue, encryptionKey));
     }
     else if (EncryptionOptionsWithSubKey.OnlyValue == encryptionOptions)
     {
         RegistryKey Test = Registry.CurrentUser.CreateSubKey(title + "\\" + subTitle);
         Test.SetValue(keyName, EncryptDecrypt.Encrypt(keyValue, encryptionKey));
     }
 }
        public async Task <ActionResult> Login(LoginViewModel model, string returnUrl = "")
        {
            if (ModelState.IsValid)
            {
                EncryptDecrypt objEncryptDecrypt = new EncryptDecrypt();
                model.Password = objEncryptDecrypt.Encrypt(model.Password, WebConfigurationManager.AppSettings["ServiceAccountPassword"]);
                Utility.MasterType  masterValue         = Utility.MasterType.ROLE;
                HttpResponseMessage roleResponseMessage = await Utility.GetObject("/api/Master/GetMasterData", masterValue, true);

                HttpResponseMessage userResponseMessage = await Utility.GetObject("/api/User/", model, true);

                if (userResponseMessage.IsSuccessStatusCode && roleResponseMessage.IsSuccessStatusCode)
                {
                    var user = await Utility.DeserializeObject <UserModel>(userResponseMessage);

                    if (user != null)
                    {
                        if (!user.EmailConfirmed)
                        {
                            ViewBag.IsUserActivated  = false;
                            ViewBag.UserNotActivated = "Please verify your registered email address and try to login again.";
                            return(View("Login"));
                        }
                        HttpResponseMessage roleNameResponseMessage = await Utility.GetObject("/api/User/" + user.RoleId, true);

                        string roleName = await Utility.DeserializeObject <string>(roleNameResponseMessage);

                        List <string> userRoles = new List <string> {
                            roleName
                        };

                        CustomPrincipalSerializeModel serializeModel = new CustomPrincipalSerializeModel();
                        serializeModel.UserId    = user.Id;
                        serializeModel.FirstName = user.FirstName;
                        serializeModel.LastName  = user.LastName;
                        serializeModel.roles     = userRoles.ToArray();

                        string userData = JsonConvert.SerializeObject(serializeModel);
                        FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(
                            1,
                            user.Email,
                            DateTime.Now,
                            DateTime.Now.AddDays(1),
                            false,                     //pass here true, if you want to implement remember me functionality
                            userData);

                        string     encTicket = FormsAuthentication.Encrypt(authTicket);
                        HttpCookie faCookie  = new HttpCookie(FormsAuthentication.FormsCookieName, encTicket);
                        Response.Cookies.Add(faCookie);
                        SessionVar.LoginUser = user;

                        if (!string.IsNullOrEmpty(returnUrl))
                        {
                            return(Redirect(returnUrl));
                        }
                        else
                        {
                            if (roleName.Contains("Admin"))
                            {
                                return(RedirectToAction("Index", "Admin"));
                            }
                            else if (roleName.Contains("User"))
                            {
                                return(RedirectToAction("MyAccount", "Account"));
                            }
                            else
                            {
                                return(RedirectToAction("Login", "Account"));
                            }
                        }
                    }
                }
            }
            return(View(model));
        }
        public async Task <ActionResult> AccountDetails(AccountDetails data, string prevBtn, string nextBtn)
        {
            UserModel              obj = GetUser();
            ToastModel             tm  = new ToastModel();
            SecurityQuestionsModel Sqm = new SecurityQuestionsModel();

            ContactDetails cd = new ContactDetails();

            cd.Address          = obj.Address;
            cd.Country          = obj.CountryId;
            ViewBag.CountryList = await _common.GetCountryData();

            ViewBag.SelectedCountry = obj.CountryId;
            cd.State = obj.StateId;
            ViewBag.SelectedState = obj.StateId;
            cd.City      = obj.City;
            cd.ZipCode   = obj.ZipCode;
            cd.HomePhone = obj.HomePhone;
            cd.CellPhone = obj.CellPhone;

            if (prevBtn != null)
            {
                //return View("ContactDetails", cd);
                return(RedirectToAction("ContactDetails", cd));
            }
            if (nextBtn != null)
            {
                Dictionary <int, string> SecurityQuestions = new Dictionary <int, string>();

                for (int i = 0; i < 5; i++)
                {
                    if ((Request.Form["AnswerTextbox_" + (i + 1)]) != "")
                    {
                        SecurityQuestions.Add((i + 1), Request.Form["AnswerTextbox_" + (i + 1)]);
                    }
                }

                AccountDetails Ad = new AccountDetails();
                Ad.Email                  = data.Email;
                Ad.Password               = data.Password;
                Ad.RetypePassword         = data.RetypePassword;
                Ad.AccountType            = data.AccountType;
                Ad.SecurityQuestionsModel = await _common.GetSecurityQuestions();

                ViewBag.SecurityQuestions = await _common.GetSecurityQuestions();

                foreach (var item in SecurityQuestions)
                {
                    Ad.SecurityQuestionsModel.ForEach(sq =>
                    {
                        if (sq.Id == item.Key)
                        {
                            sq.Value = item.Value;
                        }
                    });
                }

                if (SecurityQuestions.Count < 2)
                {
                    return(View("AccountDetails", Ad));
                }

                else
                {
                    if (ModelState.IsValid)
                    {
                        bool userRejected  = false;
                        bool isEmailExists = await _account.IsActiveUser(data.Email);

                        bool isFamilyMember = await _account.IsFamilyMember(data.Email);

                        int isAddressOrHomePhoneMatched = await _account.IsAddressOrHomePhoneMatched(cd);

                        if (isEmailExists)
                        {
                            tm.IsSuccess  = false;
                            tm.Message    = "Email already registered";
                            ViewBag.Toast = tm;
                            return(View("AccountDetails", Ad));
                        }

                        obj.Email    = data.Email;
                        obj.Password = data.Password;
                        EncryptDecrypt objEncryptDecrypt = new EncryptDecrypt();
                        obj.Password              = objEncryptDecrypt.Encrypt(data.Password, WebConfigurationManager.AppSettings["ServiceAccountPassword"]);
                        obj.IsIndividual          = Convert.ToBoolean(data.AccountType);
                        obj.UserSecurityQuestions = SecurityQuestions;
                        obj.Status = false;

                        // case: If user is added as a member of someone else's family
                        // send approval mail to primary account holder and user should be in inactive status until request has approved.
                        if (isFamilyMember || isAddressOrHomePhoneMatched != 0)
                        {
                            obj.IsIndividual      = true;
                            obj.IsApproveMailSent = true;
                            string primaryAccountEmail = string.Empty;

                            int emailTemplateId = isFamilyMember ? 2 : 9;
                            // if user has already requested for logins and again trying to get register
                            UserModel um = await _user.GetUserInfo(data.Email);

                            if (!string.IsNullOrEmpty(um.Id))
                            {
                                // if primary a/c holder Rejected the user request
                                if ((bool)um.IsApproveMailSent && um.IsApproved != null)
                                {
                                    userRejected = true;
                                    // so we have to reset the approval request
                                    um.IsApproved = null;
                                    // we need to update the user
                                    HttpResponseMessage userResponseMessage = await Utility.GetObject("/api/User/PostUser", um, true);
                                }

                                // approval mail sent to primary a/c and not yet decided
                                if ((bool)um.IsApproveMailSent && um.IsApproved == null && !userRejected)
                                {
                                    ViewBag.ApproveMailSent = true;
                                    ViewBag.ApproveContent  = "An approval email has been already sent to primary account holder of your family..! Please be patient until your request has been approved.";
                                    return(View("AccountDetails", Ad));
                                }
                            }

                            ViewBag.IsFamilyMember = true;
                            EmailTemplateModel etm1 = await _account.GetEmailTemplate(emailTemplateId);

                            string toUserFullname = string.IsNullOrEmpty(um.Id) ? obj.FirstName + " " + obj.LastName : await _user.GetUserFullName(data.Email);

                            if (isAddressOrHomePhoneMatched == 0)
                            {
                                primaryAccountEmail = await _account.GetFamilyPrimaryAccountEmail(data.Email);
                            }
                            else
                            {
                                primaryAccountEmail =
                                    isAddressOrHomePhoneMatched == 1
                                                                ? await _account.GetPrimaryAccountEmailByHomePhone(obj.HomePhone)
                                                                : await _account.GetPrimaryAccountEmailByAddress(cd);
                            }

                            string fromUserFullname = await _user.GetUserFullName(primaryAccountEmail);

                            string approvalLink1 = configMngr["SharedAccountRequestLink"]
                                                   + objEncryptDecrypt.Encrypt(data.Email, configMngr["ServiceAccountPassword"])
                                                   + "&aadm="
                                                   + isAddressOrHomePhoneMatched;

                            string emailBody1 = etm1.Body
                                                .Replace("[ToUsername]", toUserFullname)
                                                .Replace("[FromUsername]", fromUserFullname)
                                                .Replace("[URL]", approvalLink1);
                            etm1.Body = emailBody1;

                            EmailManager em1 = new EmailManager
                            {
                                Body    = etm1.Body,
                                To      = data.Email,
                                Subject = etm1.Subject,
                                From    = ConfigurationManager.AppSettings["SMTPUsername"]
                            };
                            em1.Send();

                            ViewBag.ApproveContent = "An approval email has been sent to primary account holder of your family..! Your account will be activated once your request has been approved.";
                            if (!userRejected)
                            {
                                HttpResponseMessage userResponseMessage = await Utility.GetObject("/api/User/PostUser", obj, true);
                            }

                            return(View("AccountDetails", Ad));
                        }

                        // If user is not a family member, allow him to register normally
                        HttpResponseMessage userResponseMessage1 = await Utility.GetObject("/api/User/PostUser", obj, true);

                        // if user registered successfully, then send an activation link
                        if (userResponseMessage1.IsSuccessStatusCode)
                        {
                            EmailTemplateModel etm = await _account.GetEmailTemplate(1);

                            string approvalLink = configMngr["UserActivationLink"]
                                                  + objEncryptDecrypt.Encrypt(data.Email, configMngr["ServiceAccountPassword"]);
                            string fullname  = obj.FirstName + " " + obj.LastName;
                            string emailBody = etm.Body
                                               .Replace("[Username]", fullname)
                                               .Replace("[URL]", approvalLink);
                            etm.Body = emailBody;

                            EmailManager em = new EmailManager
                            {
                                Body    = etm.Body,
                                To      = data.Email,
                                Subject = etm.Subject,
                                From    = ConfigurationManager.AppSettings["SMTPUsername"]
                            };
                            em.Send();
                        }
                        return(RedirectToAction("Login", "Account"));
                    }
                }
            }

            return(View());
        }
        /// <summary>
        /// Initialize and verify settings for job
        /// </summary>
        /// <param name="context">The context.</param>
        /// <exception cref="JobExecutionException">
        /// </exception>
        public virtual void Initialize(IJobExecutionContext context)
        {
            var dataMap = context.JobDetail.JobDataMap;

            AosUri = dataMap.GetString(SettingsConstants.AosUri);
            if (string.IsNullOrEmpty(AosUri))
            {
                throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture, Resources.AOS_URL_is_missing_in_job_configuration));
            }
            //remove trailing slash if any
            AosUri = AosUri.TrimEnd('/');

            AzureAuthEndpoint = dataMap.GetString(SettingsConstants.AzureAuthEndpoint);
            if (string.IsNullOrEmpty(AzureAuthEndpoint))
            {
                throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture, Resources.Azure_authentication_endpoint_URL_is_missing_in_job_configuration));
            }

            AadTenant = dataMap.GetString(SettingsConstants.AadTenant);
            if (string.IsNullOrEmpty(AadTenant))
            {
                throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture, Resources.AAD_tenant_id_is_missing_in_job_configuration));
            }

            UseServiceAuthentication = Convert.ToBoolean(dataMap.GetString(SettingsConstants.UseServiceAuthentication));

            var aadClientIdStr = dataMap.GetString(SettingsConstants.AadClientId);

            if (!Guid.TryParse(aadClientIdStr, out Guid aadClientGuid) || (Guid.Empty == aadClientGuid))
            {
                throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture, Resources.Azure_application_client_id_is_missing_or_is_not_a_GUID_in_job_configuration));
            }
            AadClientId = aadClientGuid;

            if (UseServiceAuthentication)
            {
                AadClientSecret = dataMap.GetString(SettingsConstants.AadClientSecret);
                if (string.IsNullOrEmpty(AadClientSecret))
                {
                    throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture, Resources.Azure_web_application_secret_is_missing_in_job_configuration));
                }
                AadClientSecret = EncryptDecrypt.Decrypt(AadClientSecret);
            }
            else
            {
                UserName = dataMap.GetString(SettingsConstants.UserName);
                if (string.IsNullOrEmpty(UserName))
                {
                    throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture, Resources.User_principal_name_is_missing_in_job_configuration));
                }

                UserPassword = dataMap.GetString(SettingsConstants.UserPassword);
                if (string.IsNullOrEmpty(UserPassword))
                {
                    throw new JobExecutionException(string.Format(CultureInfo.InvariantCulture, Resources.User_password_is_missing_in_job_configuration));
                }
                UserPassword = EncryptDecrypt.Decrypt(UserPassword);
            }

            Interval = dataMap.GetInt(SettingsConstants.Interval);
            if (Interval < 100) //Default execution interval is 100 ms.
            {
                Interval = 100;
            }

            RetryCount = dataMap.GetInt(SettingsConstants.RetryCount);
            if (RetryCount == 0)
            {
                RetryCount = 1;
            }

            RetryDelay = dataMap.GetInt(SettingsConstants.RetryDelay);
            if (RetryDelay == 0)
            {
                RetryDelay = 60; //seconds
            }

            PauseJobOnException = Convert.ToBoolean(dataMap.GetString(SettingsConstants.PauseJobOnException));

            IndefinitePause = Convert.ToBoolean(dataMap.GetString(SettingsConstants.IndefinitePause));

            ImportFromPackageActionPath = dataMap.GetString(SettingsConstants.ImportFromPackageActionPath);
            if (string.IsNullOrEmpty(ImportFromPackageActionPath))
            {
                ImportFromPackageActionPath = OdataActionsConstants.ImportFromPackageActionPath;
            }

            GetAzureWriteUrlActionPath = dataMap.GetString(SettingsConstants.GetAzureWriteUrlActionPath);
            if (string.IsNullOrEmpty(GetAzureWriteUrlActionPath))
            {
                GetAzureWriteUrlActionPath = OdataActionsConstants.GetAzureWriteUrlActionPath;
            }

            GetExecutionSummaryStatusActionPath = dataMap.GetString(SettingsConstants.GetExecutionSummaryStatusActionPath);
            if (string.IsNullOrEmpty(GetExecutionSummaryStatusActionPath))
            {
                GetExecutionSummaryStatusActionPath = OdataActionsConstants.GetExecutionSummaryStatusActionPath;
            }

            GetExportedPackageUrlActionPath = dataMap.GetString(SettingsConstants.GetExportedPackageUrlActionPath);
            if (string.IsNullOrEmpty(GetExportedPackageUrlActionPath))
            {
                GetExportedPackageUrlActionPath = OdataActionsConstants.GetExportedPackageUrlActionPath;
            }

            GetExecutionSummaryPageUrlActionPath = dataMap.GetString(SettingsConstants.GetExecutionSummaryPageUrlActionPath);
            if (string.IsNullOrEmpty(GetExecutionSummaryPageUrlActionPath))
            {
                GetExecutionSummaryPageUrlActionPath = OdataActionsConstants.GetExecutionSummaryPageUrlActionPath;
            }

            DeleteExecutionHistoryJobActionPath = dataMap.GetString(SettingsConstants.DeleteExecutionHistoryJobActionPath);
            if (string.IsNullOrEmpty(DeleteExecutionHistoryJobActionPath))
            {
                DeleteExecutionHistoryJobActionPath = OdataActionsConstants.DeleteExecutionHistoryJobActionPath;
            }

            ExportToPackageActionPath = dataMap.GetString(SettingsConstants.ExportToPackageActionPath);
            if (string.IsNullOrEmpty(ExportToPackageActionPath))
            {
                ExportToPackageActionPath = OdataActionsConstants.ExportToPackageActionPath;
            }

            ExportFromPackageActionPath = dataMap.GetString(SettingsConstants.ExportFromPackageActionPath);
            if (string.IsNullOrEmpty(ExportFromPackageActionPath))
            {
                ExportFromPackageActionPath = OdataActionsConstants.ExportFromPackageActionPath;
            }

            GetMessageStatusActionPath = dataMap.GetString(SettingsConstants.GetMessageStatusActionPath);
            if (string.IsNullOrEmpty(GetMessageStatusActionPath))
            {
                GetMessageStatusActionPath = OdataActionsConstants.GetMessageStatusActionPath;
            }
        }
示例#32
0
        public List <FobManagement> GetAllApplicant(long TenantID)
        {
            List <FobManagement> modelList = new List <FobManagement>();
            ShomaRMEntities      db        = new ShomaRMEntities();
            string relat = string.Empty;
            string unit  = string.Empty;
            string Bed   = string.Empty;
            var    getAllApplicantList = db.tbl_Applicant.Where(co => co.TenantID == TenantID).ToList();

            if (getAllApplicantList != null)
            {
                foreach (var item in getAllApplicantList)
                {
                    string SSN = String.Empty;
                    if (item.Type == "Primary Applicant")
                    {
                        var getSSN = db.tbl_TenantOnline.Where(co => co.ProspectID == item.TenantID).FirstOrDefault();
                        SSN = new EncryptDecrypt().DecryptText(getSSN.SSN);
                        SSN = "***-**-" + SSN.Substring(5);
                    }
                    else
                    {
                        SSN = "None";
                    }

                    var getPropId = db.tbl_ApplyNow.Where(co => co.ID == item.TenantID).FirstOrDefault();
                    if (getPropId != null)
                    {
                        var getUnitNo = db.tbl_PropertyUnits.Where(co => co.UID == getPropId.PropertyId).FirstOrDefault();
                        if (getUnitNo != null)
                        {
                            unit = getUnitNo.UnitNo;
                            Bed  = getUnitNo.Bedroom != null?getUnitNo.Bedroom.ToString() : "0";
                        }
                    }

                    if (item.Type == "Primary Applicant")
                    {
                        relat = item.Relationship == "1" ? "Self" : "";
                    }
                    else if (item.Type == "Co-Applicant")
                    {
                        relat = item.Relationship == "1" ? "Spouse" : item.Relationship == "2" ? "Partner" : item.Relationship == "3" ? "Adult Child" : "";
                    }
                    else if (item.Type == "Minor")
                    {
                        relat = item.Relationship == "1" ? "Family Member" : item.Relationship == "2" ? "Child" : "";
                    }
                    else if (item.Type == "Guarantor")
                    {
                        relat = item.Relationship == "1" ? "Family" : item.Relationship == "2" ? "Friend" : "";
                    }

                    var getDataTenantFob = db.tbl_TenantFob.Where(co => co.ApplicantID == item.ApplicantID).ToList();
                    if (getDataTenantFob != null)
                    {
                        if (getDataTenantFob.Count > 0)
                        {
                            foreach (var df in getDataTenantFob)
                            {
                                if (item.Type != "Guarantor")
                                {
                                    modelList.Add(new FobManagement()
                                    {
                                        FirstName         = item.FirstName,
                                        LastName          = item.LastName,
                                        Type              = item.Type,
                                        Relationship      = relat,
                                        ApplicantID       = item.ApplicantID,
                                        TenantID          = item.TenantID,
                                        UnitNo            = unit,
                                        Bedrooms          = Bed,
                                        FullName          = item.FirstName + " " + item.LastName,
                                        DateOfBirthTxt    = item.DateOfBirth.HasValue ? item.DateOfBirth.Value.ToString("MM/dd/yyyy") : "",
                                        Email             = !string.IsNullOrWhiteSpace(item.Email) ? item.Email : "",
                                        Gender            = item.Gender,
                                        MoveInPercentage  = item.MoveInPercentage.HasValue ? item.MoveInPercentage.Value.ToString() : "0.00",
                                        MoveInCharges     = item.MoveInCharge.HasValue ? item.MoveInCharge.Value.ToString("0.00") : "0.00",
                                        MonthlyPercentage = item.MonthlyPercentage.HasValue ? item.MonthlyPercentage.Value.ToString() : "0.00",
                                        MonthlyCharges    = item.MonthlyPayment.HasValue ? item.MonthlyPayment.Value.ToString("0.00") : "0.00",
                                        SSNstring         = SSN,
                                        FobID             = df.FobID,
                                        Status            = df.Status
                                    });
                                }
                            }
                        }
                        else
                        {
                            if (item.Type != "Guarantor")
                            {
                                modelList.Add(new FobManagement()
                                {
                                    FirstName         = item.FirstName,
                                    LastName          = item.LastName,
                                    Type              = item.Type,
                                    Relationship      = relat,
                                    ApplicantID       = item.ApplicantID,
                                    TenantID          = item.TenantID,
                                    UnitNo            = unit,
                                    Bedrooms          = Bed,
                                    FullName          = item.FirstName + " " + item.LastName,
                                    DateOfBirthTxt    = item.DateOfBirth.HasValue ? item.DateOfBirth.Value.ToString("MM/dd/yyyy") : "",
                                    Email             = !string.IsNullOrWhiteSpace(item.Email) ? item.Email : "",
                                    Gender            = item.Gender,
                                    MoveInPercentage  = item.MoveInPercentage.HasValue ? item.MoveInPercentage.Value.ToString() : "0.00",
                                    MoveInCharges     = item.MoveInCharge.HasValue ? item.MoveInCharge.Value.ToString("0.00") : "0.00",
                                    MonthlyPercentage = item.MonthlyPercentage.HasValue ? item.MonthlyPercentage.Value.ToString() : "0.00",
                                    MonthlyCharges    = item.MonthlyPayment.HasValue ? item.MonthlyPayment.Value.ToString("0.00") : "0.00",
                                    SSNstring         = SSN,
                                    FobID             = "",
                                    Status            = 0,
                                });
                            }
                        }
                    }
                    else
                    {
                        if (item.Type != "Guarantor")
                        {
                            modelList.Add(new FobManagement()
                            {
                                FirstName         = item.FirstName,
                                LastName          = item.LastName,
                                Type              = item.Type,
                                Relationship      = relat,
                                ApplicantID       = item.ApplicantID,
                                TenantID          = item.TenantID,
                                UnitNo            = unit,
                                Bedrooms          = Bed,
                                FullName          = item.FirstName + " " + item.LastName,
                                DateOfBirthTxt    = item.DateOfBirth.HasValue ? item.DateOfBirth.Value.ToString("MM/dd/yyyy") : "",
                                Email             = !string.IsNullOrWhiteSpace(item.Email) ? item.Email : "",
                                Gender            = item.Gender,
                                MoveInPercentage  = item.MoveInPercentage.HasValue ? item.MoveInPercentage.Value.ToString() : "0.00",
                                MoveInCharges     = item.MoveInCharge.HasValue ? item.MoveInCharge.Value.ToString("0.00") : "0.00",
                                MonthlyPercentage = item.MonthlyPercentage.HasValue ? item.MonthlyPercentage.Value.ToString() : "0.00",
                                MonthlyCharges    = item.MonthlyPayment.HasValue ? item.MonthlyPayment.Value.ToString("0.00") : "0.00",
                                SSNstring         = SSN,
                                FobID             = "",
                                Status            = 0,
                            });
                        }
                    }
                }
                var getDataTenantFobOther = db.tbl_TenantFob.Where(co => co.ApplicantID == 0 && co.TenantID == TenantID).ToList();
                if (getDataTenantFobOther != null)
                {
                    foreach (var ct in getDataTenantFobOther)
                    {
                        modelList.Add(new FobManagement()
                        {
                            FirstName    = ct.OtherFirstName,
                            LastName     = ct.OtherLastName,
                            Type         = "Other",
                            Relationship = ct.OtherRelationship,
                            ApplicantID  = 0,
                            TenantID     = ct.TenantID,
                            UnitNo       = unit,
                            Bedrooms     = Bed,
                            FullName     = ct.OtherFirstName + " " + ct.OtherLastName,
                            OtherId      = ct.OtherId,
                            FobID        = ct.FobID,
                            Status       = ct.Status,
                        });
                    }
                }
            }
            db.Dispose();
            return(modelList);
        }
示例#33
0
    IEnumerator _Send()
    {
        IMHttpContext ctx     = sendQueue.Dequeue();
        BonDocument   request = new BonDocument();

        ctx.request   = request;
        request["ul"] = ctx.ul.GetType().Name;
        BonDocument p = BonUtil.ToBon(ctx.ul, null, null) as BonDocument;

        request["p"]   = p;
        ctx.sno        = (++snoSeed);
        request["sno"] = ctx.sno;
        IMMe me = IM.Instance.me;

        if (me != null)
        {
            p["uid"] = me.id;
            if (me.auth != null)
            {
                request["auth"] = me.auth;
            }
        }
        byte[] postdata = ctx.request.ToBonBytes();
        postdata = EncryptDecrypt.Encrypt(postdata);

        while (ctx.retry >= 0)
        {
#if HTTP_DEBUG_LOG
            Debug.Log("发送数据{" + postdata.Length + "}: " + ctx.request.ToJsonString());
            Debug.Log("到: " + ctx.url);
#endif
            ctx.sendTime = TimeUtil.UnixTimestampNow();
            float  lastProgress = 0;
            double timeout      = TimeUtil.UnixTimestampNow() + 10;
            bool   isTimeout    = false;
            using (WWW www = new WWW(ctx.url, postdata, header)) {
                while (!www.isDone)
                {
                    double now = TimeUtil.UnixTimestampNow();
                    if (now >= timeout)
                    {
                        isTimeout = true;
                        break;
                    }
                    if (lastProgress != www.progress)
                    {
                        lastProgress = www.progress;
                        timeout      = now + 20;
                    }
                    yield return(null);
                }
                if (destroyed)
                {
                    busy = false;
                    yield break;
                }
                if (isTimeout)
                {
                    ctx.error = "UI.网络错误";
                    ctx.code  = -1;
                    Debug.LogError("访问超时");
                }
                else if (www.error != null)
                {
                    ctx.error = "UI.网络错误";
                    ctx.code  = -1;
                    Debug.LogError("Err:" + www.error);
                }
                else
                {
                    byte[] data = www.bytes;
                    try {
                        if (data[0] == 31)
                        {
                            try {
                                data = GZip.Decompress(data);
                            } catch (Exception) { }
                        }
                        ctx.response = BonDocument.FromBonBytes(data);
#if HTTP_DEBUG_LOG
                        Debug.Log("收到数据: " + ctx.response);
#endif
                        ctx.code  = ctx.response.GetInt("code");
                        ctx.error = null;
                        ctx.retry = 0;
                    } catch (Exception e) {
                        ctx.error = "数据解析错误";
                        Debug.LogError("下行数据解析错误 " + e.ToString());
                    }
                }
            }
            ctx.retry--;
        }
        busy = false;
        if (ctx.callback != null)
        {
            ctx.callback(ctx);
        }
        if (OnResult != null)
        {
            OnResult(ctx);
        }
    }
示例#34
0
        public bool IsValidlogin(string USER_ID, string PASSWORD)
        {
            var isvaliduser = dbCon.PA_MOB_CUST_SIGHN_UP.AsEnumerable().Where(x => x.EMAIL_ID.ToUpper().Trim() == USER_ID.ToUpper().Trim() && x.PASSWORD == EncryptDecrypt.Encrypt(PASSWORD) && x.ISACTIVE == true).FirstOrDefault();

            if (isvaliduser != null)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#35
0
        private void ValidateButton_Click(object sender, EventArgs e)
        {
            messagesTextBox.Text = string.Empty;
            User user = null;

            if (userAuthRadioButton.Checked)
            {
                user = (User)userComboBox.SelectedItem;
                if (user == null)
                {
                    messagesTextBox.Text = Resources.Select_user_first;
                    return;
                }
            }

            var application = (AadApplication)aadApplicationComboBox.SelectedItem;

            if (application == null)
            {
                messagesTextBox.Text = Resources.Select_AAD_client_first;
                return;
            }

            Guid.TryParse(application.ClientId, out Guid aadClientGuid);

            var settings = new Common.JobSettings.DownloadJobSettings
            {
                RetryCount               = 1,
                RetryDelay               = 1,
                AadClientId              = aadClientGuid,
                AadClientSecret          = EncryptDecrypt.Decrypt(application.Secret),
                ActivityId               = Guid.Empty,
                UseServiceAuthentication = serviceAuthRadioButton.Checked
            };

            if (Instance != null)
            {
                settings.AadTenant         = Instance.AadTenant;
                settings.AosUri            = Instance.AosUri.TrimEnd('/');
                settings.AzureAuthEndpoint = Instance.AzureAuthEndpoint;
                settings.UseADAL           = Instance.UseADAL;
            }
            if (user != null)
            {
                settings.UserName     = user.Login;
                settings.UserPassword = EncryptDecrypt.Decrypt(user.Password);
            }

            var httpClientHelper = new HttpClientHelper(settings);

            try
            {
                var response = Task.Run(async() =>
                {
                    var result = await httpClientHelper.GetRequestAsync(new Uri(settings.AosUri));
                    return(result);
                });
                response.Wait();

                messagesTextBox.Text += Resources.AAD_authentication_was_successful + Environment.NewLine;

                if (response.Result.StatusCode == HttpStatusCode.OK)
                {
                    messagesTextBox.Text += Resources.D365FO_instance_seems_to_be_up_and_running + Environment.NewLine;
                }
                else
                {
                    messagesTextBox.Text += $"{Resources.Warning_HTTP_response_status_for_D365FO_instance_is} {response.Result.StatusCode} {response.Result.ReasonPhrase}." + Environment.NewLine;
                }

                var checkAccess         = httpClientHelper.GetDequeueUri();
                var checkAccessResponse = Task.Run(async() =>
                {
                    var result = await httpClientHelper.GetRequestAsync(checkAccess);
                    return(result);
                });
                checkAccessResponse.Wait();
                if (checkAccessResponse.Result.StatusCode == HttpStatusCode.Forbidden)
                {
                    if (settings.UseServiceAuthentication)
                    {
                        messagesTextBox.Text += Resources.AAD_application_is_not_mapped + Environment.NewLine;
                    }
                    else
                    {
                        messagesTextBox.Text += Resources.User_is_not_enabled + Environment.NewLine;
                    }
                }
                else if (checkAccessResponse.Result.StatusCode == HttpStatusCode.InternalServerError)
                {
                    //Internal error is expected as we are using empty guid as activity id. We only check access to API
                    //TODO: Investigate better approach
                    messagesTextBox.Text += Resources.Access_to_D365FO_instance_was_successful + Environment.NewLine;
                }
            }
            catch (Exception ex)
            {
                if (!string.IsNullOrEmpty(ex.Message))
                {
                    messagesTextBox.Text += ex.Message + Environment.NewLine;
                }
                var inner = ex;
                while (inner.InnerException != null)
                {
                    var innerMessage = inner.InnerException?.Message;
                    if (!string.IsNullOrEmpty(innerMessage))
                    {
                        messagesTextBox.Text += innerMessage + Environment.NewLine;
                    }
                    inner = inner.InnerException;
                }
            }
        }
示例#36
0
        public static string GetConnectionString()
        {
            if (string.IsNullOrEmpty(m_strConn))
            {
                try
                {
                    string strConn                = string.Empty;
                    string strSQLServer           = "(local)\\SQLEXPRESS";
                    string strDBName              = "db_Custom";
                    bool   bWindowsAuthentication = false;

                    RegistryKey rkRegTVCS = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Custom\\TVCS");
                    strSQLServer           = (string)rkRegTVCS.GetValue("SQLServer");
                    bWindowsAuthentication = (string)rkRegTVCS.GetValue("SQLWinAccount") == "1" ? true : false;
                    string strHomeDirectory = (string)rkRegTVCS.GetValue("HomeDirectory");
                    strDBName = (string)rkRegTVCS.GetValue("DBName");

                    using (StreamReader srDataSourceReader = new StreamReader(new FileStream(Path.Combine(strHomeDirectory, "DataSource.xml"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite)))
                    {
                        XPathDocument     xpdDataSourceDocument = new XPathDocument(srDataSourceReader);
                        XPathNodeIterator xpniSourceNode        = xpdDataSourceDocument.CreateNavigator().Select("/DataSource/Source");
                        if (xpniSourceNode == null)
                        {
                            return(strConn);
                        }

                        xpniSourceNode.MoveNext();
                        string strUserID   = xpniSourceNode.Current.GetAttribute("ID", "");
                        string strPassword = new EncryptDecrypt().NewDecryptStr(xpniSourceNode.Current.GetAttribute("Password", ""));

                        SqlConnectionStringBuilder connBuilder = new SqlConnectionStringBuilder();
                        if (bWindowsAuthentication)
                        {
                            // strConnString = String.Format("Persist Security Info=False;Integrated Security=SSPI;User ID={0};Password='******';Initial Catalog={2};Server={3};Pooling=False", strUserID, strPassword, strDBName, strSQLServer);
                            connBuilder.PersistSecurityInfo = false;
                            connBuilder.IntegratedSecurity  = true;
                            connBuilder.UserID         = strUserID;
                            connBuilder.Password       = strPassword;
                            connBuilder.InitialCatalog = strDBName;
                            connBuilder.DataSource     = strSQLServer;
                            connBuilder.Pooling        = false;
                        }
                        else
                        {
                            //strConnString = String.Format("Persist Security Info=False;User ID='{0}';Password='******';Initial Catalog={2};Server={3};Pooling=False", strUserID, strPassword, strDBName, strSQLServer);
                            connBuilder.PersistSecurityInfo = false;
                            connBuilder.UserID         = strUserID;
                            connBuilder.Password       = strPassword;
                            connBuilder.InitialCatalog = strDBName;
                            connBuilder.DataSource     = strSQLServer;
                            connBuilder.Pooling        = false;
                        }
                        strConn = connBuilder.ConnectionString;
                    }
                    m_strConn = strConn;
                }
                catch
                {//Static method cannot invoke log4net instance, throw it to caller for logging.
                    throw;
                }
            }

            return(m_strConn);
        }
示例#37
0
        public async Task <AdminInfo> LoginAsync(string loginName, string passWord)
        {
            var listModel = await _adminInfoRepository.GetAllasync(p => p.LoginName == loginName || p.Mobile == EncryptDecrypt.Encrypt3DES(loginName, _accessSettings.Value.Key));

            if (listModel.Any())
            {
                var model   = listModel.FirstOrDefault();
                var saltKey = model.SaltKey;
                var passMd5 = EncryptDecrypt.EncryptMD5(EncryptDecrypt.EncryptMD5Salt(passWord, saltKey).ToUpper());
                if (passMd5 == model.PassWord)
                {
                    return(model);
                }
            }
            return(new AdminInfo());
        }
示例#38
0
        /// <summary>
        /// encrypt the encrypted content
        /// </summary>
        /// <param name="content"> decrypted content</param>
        /// <returns> encrypted content as string </returns>
        public string EncryptContent(string content)
        {
            EncryptDecrypt objEncryptDecrypt = new EncryptDecrypt();

            return(objEncryptDecrypt.Encrypt(content, configMngr["ServiceAccountPassword"]));
        }
        private void ValidateButton_Click(object sender, EventArgs e)
        {
            messagesTextBox.Text = string.Empty;
            User user = null;

            if (userAuthRadioButton.Checked)
            {
                user = (User)userComboBox.SelectedItem;
                if (user == null)
                {
                    messagesTextBox.Text = Resources.Select_user_first;
                    return;
                }
            }

            var application = (AadApplication)aadApplicationComboBox.SelectedItem;

            if (application == null)
            {
                messagesTextBox.Text = Resources.Select_AAD_client_first;
                return;
            }

            var settings = new Common.JobSettings.Settings();

            Guid.TryParse(application.ClientId, out Guid aadClientGuid);
            settings.AadClientId     = aadClientGuid;
            settings.AadClientSecret = EncryptDecrypt.Decrypt(application.Secret);

            if (Instance != null)
            {
                settings.AadTenant         = Instance.AadTenant;
                settings.AosUri            = Instance.AosUri.TrimEnd('/');;
                settings.AzureAuthEndpoint = Instance.AzureAuthEndpoint;
            }
            if (user != null)
            {
                settings.UserName     = user.Login;
                settings.UserPassword = EncryptDecrypt.Decrypt(user.Password);
            }
            settings.UseServiceAuthentication = serviceAuthRadioButton.Checked;

            var httpClientHelper = new HttpClientHelper(settings);

            try
            {
                var response = Task.Run(async() =>
                {
                    var result = await httpClientHelper.GetRequestAsync(new Uri(settings.AosUri));
                    return(result);
                });
                response.Wait();

                if (response.Result.StatusCode == HttpStatusCode.OK)
                {
                    messagesTextBox.Text = response.Result.ReasonPhrase;
                }
            }
            catch (Exception ex)
            {
                if (!string.IsNullOrEmpty(ex.Message))
                {
                    messagesTextBox.Text = messagesTextBox.Text + Environment.NewLine + ex.Message;
                }
                var inner = ex;
                while (inner.InnerException != null)
                {
                    var innerMessage = inner.InnerException?.Message;
                    if (!string.IsNullOrEmpty(innerMessage))
                    {
                        messagesTextBox.Text = messagesTextBox.Text + Environment.NewLine + innerMessage;
                    }
                    inner = inner.InnerException;
                }
            }
        }
示例#40
0
        /// <summary>
        /// Encrypt a setting string
        /// </summary>
        /// <param name="decrypted">An unencrypted string</param>
        /// <returns>The string encrypted</returns>
        internal static string EncryptString(string decrypted)
        {
            EncryptDecrypt Crypto = new EncryptDecrypt();
            string encrypted = String.Empty;

            try
            {
                encrypted = Crypto.Encrypt(decrypted);
            }
            catch (Exception)
            {
                WifiRemote.LogMessage("Could not encrypt setting string!", LogType.Error);
                encrypted = null;
            }

            return encrypted;
        }
 public ActionResult ForgotPassword(ForgotPasswordViewModel fpm)
 {
     if (_unitOfWork.GetRepositoryInstance <Tbl_Members>().GetFirstOrDefaultByParameter(i => i.EmailId == fpm.EmailId && i.IsActive == true && i.IsDelete == false) != null)
     {
         string body    = string.Empty;
         string subject = string.Empty;
         using (var sr = new StreamReader(Server.MapPath("~/EmailTemplates/") + "ForgotPassword.html"))
         {
             body    = sr.ReadToEnd();
             subject = "Online Shopping : Reset Password";
         }
         body = body.Replace("_ResetPasswordUrl", System.Configuration.ConfigurationManager.AppSettings["ApplicationRootUrl"] + "/Account/ResetPassword?EmailId=" + EncryptDecrypt.Encrypt(fpm.EmailId, true));
         EmailNotification.SendMail(fpm.EmailId, subject, body);
         ViewBag.SendEmailMessage = "Password reset link is sent at your email address. Please check your email";
     }
     else
     {
         ModelState.AddModelError("EmailId", "Email Not Registered");
     }
     return(View(fpm));
 }
        public ActionResult Index(string type, string value)
        {
            BillingProposalReply obj = new BillingProposalReply();


            string BtnType           = string.Empty;
            string accExecutiveEmail = string.Empty;
            string accExecutiveName  = string.Empty;
            string orderno           = string.Empty;
            string location          = string.Empty;
            string pages             = string.Empty;
            string amount            = string.Empty;
            string partno            = string.Empty;
            string AttorneyNm        = string.Empty;
            string AttyID            = string.Empty;
            string FileVersionID     = string.Empty;

            BtnType = (HttpUtility.UrlDecode(EncryptDecrypt.Decrypt(type)));
            string[] querystring = HttpUtility.UrlDecode(EncryptDecrypt.Decrypt(value)).Split(',');
            //strQueryString = accExecutiveEmail + "," + accExecutiveName + "," + orderNo + "," + location.Name1 + " " + location.Name1 + "(" + location.LocID + ")" + "," + strPages + "," + strAmount;
            accExecutiveEmail = querystring[0].ToString();
            accExecutiveName  = querystring[1].ToString();
            orderno           = querystring[2].ToString();
            location          = querystring[3].ToString();
            pages             = querystring[4].ToString();
            amount            = querystring[5].ToString();
            partno            = querystring[6].ToString();
            AttorneyNm        = querystring[7].ToString();
            try
            {
                AttyID        = querystring[8].ToString();
                FileVersionID = querystring[9].ToString();
            }
            catch (Exception ex)
            {
            }
            int CompanyNo = 0;
            CompanyDetailForEmailEntity objCompany = new CompanyDetailForEmailEntity();
            string currentUrl = Request.Url.AbsoluteUri;
            var    response   = homeApiController.GetCompanyNoBySiteUrl(currentUrl);

            CompanyNo  = response.Data[0];
            objCompany = CommonFunction.CompanyDetailForEmail(CompanyNo);

            if (BtnType.ToLower() == "n")
            {
                string subject = "Billing Proposal Reply - Reject " + Convert.ToString(orderno) + "-" + Convert.ToString(partno);
                string body    = string.Empty;
                using (System.IO.StreamReader reader = new System.IO.StreamReader(AppDomain.CurrentDomain.BaseDirectory + "/MailTemplate/WaiverBillingReplyRejected.html"))
                {
                    body = reader.ReadToEnd();
                }

                body = body.Replace("{UserName}", accExecutiveName);
                body = body.Replace("{ORDERNO}", orderno);
                body = body.Replace("{LOCATION}", location);
                body = body.Replace("{PAGES}", pages);
                body = body.Replace("{COST}", amount);
                body = body.Replace("{ATTYINFO}", AttorneyNm); //23052016
                body = body.Replace("{PARTNO}", partno);
                body = body.Replace("{LogoURL}", objCompany.Logopath);
                body = body.Replace("{ThankYou}", objCompany.ThankYouMessage);
                body = body.Replace("{CompanyName}", objCompany.CompName);
                body = body.Replace("{Link}", objCompany.SiteURL);

                EmailHelper.Email.Send(CompanyNo: objCompany.CompNo
                                       , mailTo: accExecutiveEmail
                                       , body: body
                                       , subject: subject
                                       , ccMail: ""
                                       , bccMail: "[email protected],[email protected]");

                UpdateWaiver(orderno, partno, AttyID, true);
            }

            obj.AccExecutiveEmail = accExecutiveEmail;
            obj.AccExecutiveName  = accExecutiveName;
            obj.OrderNo           = orderno;
            obj.Location          = location;
            obj.Pages             = pages;
            obj.Amount            = amount;
            obj.AttorneyNm        = AttorneyNm;
            obj.PartNo            = partno;
            obj.BtnType           = BtnType.ToLower();
            obj.AttyID            = AttyID;
            obj.CompanyNo         = CompanyNo.ToString();
            obj.CompanyName       = objCompany.CompName;
            obj.LogoPath          = objCompany.Logopath;
            obj.FileVersionID     = FileVersionID;

            return(View(obj));
        }
示例#43
0
        public string SaveUpdateAmenityRequestStatus(string AmenityName, int ARID, int Status)
        {
            string          msg = "";
            ShomaRMEntities db  = new ShomaRMEntities();

            if (ARID != 0)
            {
                var GetARRData = db.tbl_AmenityReservation.Where(p => p.ARID == ARID).FirstOrDefault();
                if (GetARRData != null)
                {
                    DateTime dtF = DateTime.Parse(GetARRData.DesiredTimeFrom != null ? GetARRData.DesiredTimeFrom : "00:00");
                    DateTime dtT = DateTime.Parse(GetARRData.DesiredTimeTo != null ? GetARRData.DesiredTimeTo : "00:00");
                    DesiredTimeFrom = dtF.ToString("HH:mm");
                    DesiredTimeTo   = dtT.ToString("HH:mm");

                    GetARRData.Status = Status;
                    db.SaveChanges();
                    msg = "Reservation Request Status Updated Successfully";

                    var    GetTenantData = db.tbl_TenantInfo.Where(p => p.TenantID == GetARRData.TenantID).FirstOrDefault();
                    string reportHTML    = "";
                    //string filePath = HttpContext.Current.Server.MapPath("~/Content/Template/");
                    string filePath = HttpContext.Current.Server.MapPath("~/Content/Templates/");
                    //reportHTML = System.IO.File.ReadAllText(filePath + "EmailTemplateAmenity.html");
                    reportHTML = System.IO.File.ReadAllText(filePath + "EmailTemplateProspect.html");
                    string message     = "";
                    string phonenumber = "";
                    string payid       = "";
                    if (GetTenantData != null)
                    {
                        phonenumber = GetTenantData.Mobile;
                        DateTime?arDate = null;
                        try
                        {
                            arDate = Convert.ToDateTime(GetARRData.DesiredDate);
                        }
                        catch
                        {
                        }
                        var tm = new MyTransactionModel();
                        reportHTML = reportHTML.Replace("[%ServerURL%]", serverURL);
                        reportHTML = reportHTML.Replace("[%TodayDate%]", DateTime.Now.ToString("dddd,dd MMMM yyyy"));

                        //reportHTML = reportHTML.Replace("[%EmailHeader%]", "Amenity Reservation Request Status");
                        //reportHTML = reportHTML.Replace("[%TenantName%]", GetTenantData.FirstName + " " + GetTenantData.LastName);

                        if (Status == 1)
                        {
                            //payment
                            //ARID = " + ARID + " & FromAcc = 0
                            payid = new EncryptDecrypt().EncryptText(ARID.ToString() + ",0");

                            string emailBody = "";
                            emailBody += "<p style=\"margin-bottom: 0px;\">Dear " + GetTenantData.FirstName + " " + GetTenantData.LastName + "</p>";
                            emailBody += "<p style=\"margin-bottom: 0px;\">We hereby approve your reservation of the " + AmenityName + " (facility) on " + arDate.Value.ToString("MM/dd/yyyy") + " (date) at " + GetARRData.DesiredTimeFrom + "to " + GetARRData.DesiredTimeTo + " (time) for a total of " + GetARRData.Duration + " (hours). For your reservation to be confirmed, the security deposit and reservation fee must be paid. If you desire to make your payment now, kindly follow this link. Please note that the date will not be reserved in the system until payment is received.</p>";
                            emailBody += "<p style=\"margin-bottom: 20px;text-align: center;\"><a href=\"" + serverURL + "/PayLink/PayAmenityCharges/?pid=" + payid + "\" class=\"link-button\" target=\"_blank\">PAY NOW</a></p>";
                            reportHTML = reportHTML.Replace("[%EmailBody%]", emailBody);

                            //reportHTML = reportHTML.Replace("[%EmailBody%]", " <p style='font-size: 14px; line-height: 21px; text-align: justify; margin: 0;'>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; We hereby approve your reservation of the " + AmenityName + " (facility) on " + arDate.Value.ToString("MM/dd/yyyy") + " (date) at " + GetARRData.DesiredTimeFrom + "to " + GetARRData.DesiredTimeTo + " (time) for a total of " + GetARRData.Duration + " (hours).  For your reservation to be confirmed, the security deposit and reservation   fee must be paid.  If you desire to make your payment now, kindly follow this link.  Please note    that the date will not be reserved in the system until payment is received. </p>");
                            //reportHTML = reportHTML.Replace("[%LeaseNowButton%]", "<!--[if mso]><table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-spacing: 0; border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;\"><tr><td style=\"padding-top: 25px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px\" align=\"center\"><v:roundrect xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w=\"urn:schemas-microsoft-com:office:word\" href=\"" + serverURL + "/PayLink/PayAmenityCharges/?pid=" + payid + "\" style=\"height:46.5pt; width:168.75pt; v-text-anchor:middle;\" arcsize=\"7%\" stroke=\"false\" fillcolor=\"#a8bf6f\"><w:anchorlock/><v:textbox inset=\"0,0,0,0\"><center style=\"color:#ffffff; font-family:'Trebuchet MS', Tahoma, sans-serif; font-size:16px\"><![endif]--> <a href=\"" + serverURL + "/PayLink/PayAmenityCharges/?pid=" + payid + "\" style=\"-webkit-text-size-adjust: none; text-decoration: none; display: inline-block; color: #ffffff; background-color: #a8bf6f; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; width: auto; width: auto; border-top: 1px solid #a8bf6f; border-right: 1px solid #a8bf6f; border-bottom: 1px solid #a8bf6f; border-left: 1px solid #a8bf6f; padding-top: 15px; padding-bottom: 15px; font-family: 'Montserrat', 'Trebuchet MS', 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans', Tahoma, sans-serif; text-align: center; mso-border-alt: none; word-break: keep-all;\" target=\"_blank\"><span style=\"padding-left:15px;padding-right:15px;font-size:16px;display:inline-block;\"><span style=\"font-size: 16px; line-height: 32px;\">PAY NOW</span></span></a><!--[if mso]></center></v:textbox></v:roundrect></td></tr></table><![endif]-->");

                            message = "Your reservation to be confirmed, the security deposit and reservation fees must be paid. Please check the email for detail.";
                        }
                        else if (Status == 2)
                        {
                            //Desposte
                            payid = new EncryptDecrypt().EncryptText(ARID.ToString() + ",0");

                            string emailBody = "";
                            emailBody += "<p style=\"margin-bottom: 0px;\">Dear " + GetTenantData.FirstName + " " + GetTenantData.LastName + "</p>";
                            emailBody += "<p style=\"margin-bottom: 0px;\">We hereby approve your reservation of the " + AmenityName + " (facility) on " + arDate.Value.ToString("MM/dd/yyyy") + " (date) at " + GetARRData.DesiredTimeFrom + "to " + GetARRData.DesiredTimeTo + " (time) for a total of " + GetARRData.Duration + " (hours). For your reservation to be Completed. Please pay your deposit. If you desire to make your payment now, kindly follow this link. Please note that the date will not be reserved in the system until payment is received.</p>";
                            emailBody += "<p style=\"margin-bottom: 20px;text-align: center;\"><a href=\"" + serverURL + "/PayLink/PayAmenityCharges/?pid=" + payid + "\" class=\"link-button\" target=\"_blank\">PAY NOW</a></p>";
                            reportHTML = reportHTML.Replace("[%EmailBody%]", emailBody);

                            //reportHTML = reportHTML.Replace("[%EmailBody%]", " <p style='font-size: 14px; line-height: 21px; text-align: justify; margin: 0;'>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; We hereby approve your reservation of the " + AmenityName + " (facility) on " + arDate.Value.ToString("MM/dd/yyyy") + " (date) at " + GetARRData.DesiredTimeFrom + "to " + GetARRData.DesiredTimeTo + " (time) for a total of " + GetARRData.Duration + " (hours).  For your reservation to be Completed. Please pay your deposit. If you desire to make your payment now, kindly follow this link.  Please note     that the date will not be reserved in the system until payment is received. </p>");
                            //reportHTML = reportHTML.Replace("[%LeaseNowButton%]", "<!--[if mso]><table width=\"100%\" cellpadding=\"0\" cellspacing=\"0\" border=\"0\" style=\"border-spacing: 0; border-collapse: collapse; mso-table-lspace:0pt; mso-table-rspace:0pt;\"><tr><td style=\"padding-top: 25px; padding-right: 10px; padding-bottom: 10px; padding-left: 10px\" align=\"center\"><v:roundrect xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w=\"urn:schemas-microsoft-com:office:word\" href=\"" + serverURL + "/PayLink/PayAmenityCharges/?pid=" + payid + "\" style=\"height:46.5pt; width:168.75pt; v-text-anchor:middle;\" arcsize=\"7%\" stroke=\"false\" fillcolor=\"#a8bf6f\"><w:anchorlock/><v:textbox inset=\"0,0,0,0\"><center style=\"color:#ffffff; font-family:'Trebuchet MS', Tahoma, sans-serif; font-size:16px\"><![endif]--> <a href=\"" + serverURL + "/PayLink/PayAmenityCharges/?pid=" + payid + "\" style=\"-webkit-text-size-adjust: none; text-decoration: none; display: inline-block; color: #ffffff; background-color: #a8bf6f; border-radius: 4px; -webkit-border-radius: 4px; -moz-border-radius: 4px; width: auto; width: auto; border-top: 1px solid #a8bf6f; border-right: 1px solid #a8bf6f; border-bottom: 1px solid #a8bf6f; border-left: 1px solid #a8bf6f; padding-top: 15px; padding-bottom: 15px; font-family: 'Montserrat', 'Trebuchet MS', 'Lucida Grande', 'Lucida Sans Unicode', 'Lucida Sans', Tahoma, sans-serif; text-align: center; mso-border-alt: none; word-break: keep-all;\" target=\"_blank\"><span style=\"padding-left:15px;padding-right:15px;font-size:16px;display:inline-block;\"><span style=\"font-size: 16px; line-height: 32px;\">PAY NOW</span></span></a><!--[if mso]></center></v:textbox></v:roundrect></td></tr></table><![endif]-->");

                            message = "Your reservation to be Completed. Please pay your deposit. Please check the email for detail.";
                        }
                        else
                        {
                            // Cancel
                            string emailBody = "";
                            emailBody += "<p style=\"margin-bottom: 0px;\">Dear " + GetTenantData.FirstName + " " + GetTenantData.LastName + "</p>";
                            emailBody += "<p style=\"margin-bottom: 0px;\">We are sorry for your reservation of the " + AmenityName + " (facility) on " + arDate.Value.ToString("MM/dd/yyyy") + " (date) at " + GetARRData.DesiredTimeFrom + "to " + GetARRData.DesiredTimeTo + " (time) for a total of " + GetARRData.Duration + " (hours). Your reservation date is not be available.</p>";
                            reportHTML = reportHTML.Replace("[%EmailBody%]", emailBody);

                            //reportHTML = reportHTML.Replace("[%EmailBody%]", " <p style='font-size: 14px; line-height: 21px; text-align: justify; margin: 0;'>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; We are sorry for your reservation of the " + AmenityName + " (facility) on " + arDate.Value.ToString("MM/dd/yyyy") + " (date) at " + GetARRData.DesiredTimeFrom + "to " + GetARRData.DesiredTimeTo + " (time) for a total of " + GetARRData.Duration + " (hours). Your reservation date is not be available. </p>");
                            //reportHTML = reportHTML.Replace("[%LeaseNowButton%]", "");

                            message = "Your reservation is cancelled due to date is not be available. Please check the email for detail.";
                        }

                        //reportHTML = reportHTML.Replace("[%TenantEmail%]", GetTenantData.Email);
                    }
                    string body = reportHTML;
                    new ShomaRM.Models.EmailSendModel().SendEmail(GetTenantData.Email, "Amenity Reservation Request Status", body);
                    if (SendMessage == "yes")
                    {
                        if (!string.IsNullOrWhiteSpace(phonenumber))
                        {
                            new TwilioService().SMS(phonenumber, message);
                        }
                    }
                }
            }
            db.Dispose();
            return(msg);
        }
示例#44
0
        /// <summary>
        /// Method to add the User in the database.
        /// </summary>
        /// <param name="m"></param>
        /// <param name="roleId"></param>
        /// <returns></returns>
        public int AddUpdateUser(Users m, int roleId)
        {
            int result;
            var userRolebal     = new UserRoleBal();
            var facilityRoleBal = new FacilityRoleBal();

            using (var transScope = new TransactionScope())
            {
                using (var usersRep = UnitOfWork.UsersRepository)
                {
                    var encryptPassword = EncryptDecrypt.GetEncryptedData(m.Password, "");
                    m.Password        = encryptPassword;
                    usersRep.AutoSave = true;
                    if (m.UserID > 0)
                    {
                        var currentUser = usersRep.Where(u => u.UserID == m.UserID).FirstOrDefault();
                        if (currentUser != null)
                        {
                            m.CreatedBy   = currentUser.CreatedBy;
                            m.CreatedDate = currentUser.CreatedDate;
                        }

                        usersRep.UpdateEntity(m, m.UserID);

                        var name = $"{m.FirstName} - {m.LastName}";

                        //Add missing updates in roles
                        if (roleId > 0)
                        {
                            using (var uRoleRep = UnitOfWork.UserRoleRepository)
                            {
                                var currentRole = uRoleRep.Where(r => r.UserID == m.UserID).FirstOrDefault();
                                if (currentRole != null && currentRole.RoleID != roleId)
                                {
                                    currentRole.RoleID       = roleId;
                                    currentRole.ModifiedBy   = m.ModifiedBy;
                                    currentRole.ModifiedDate = m.ModifiedDate;
                                    uRoleRep.UpdateEntity(currentRole, currentRole.UserRoleID);

                                    //Update the roles in Physician Table too if schedulingApplied is set true to that current role in FacilityRole Table.
                                    var isSchedulingApplied = facilityRoleBal.IsSchedulingApplied(roleId);
                                }
                            }
                        }


                        if (Convert.ToBoolean(m.IsDeleted))
                        {
                            userRolebal.DeleteRoleWithUser(m.UserID);
                        }
                        transScope.Complete();
                    }
                    else
                    {
                        usersRep.Create(m);

                        //Check if User Role is added
                        if (m.UserID > 0 && roleId > 0)
                        {
                            var userRoleModel = new UserRole
                            {
                                UserID      = m.UserID,
                                RoleID      = roleId,
                                IsActive    = true,
                                IsDeleted   = false,
                                CreatedBy   = m.CreatedBy,
                                CreatedDate = m.CreatedDate,
                                UserRoleID  = 0
                            };
                            var newUserRoleId = userRolebal.SaveUserRole(userRoleModel);
                            if (newUserRoleId > 0)
                            {
                                var facilityRoleModel = new FacilityRole
                                {
                                    RoleId         = roleId,
                                    FacilityRoleId = 0,
                                    FacilityId     = Convert.ToInt32(m.FacilityId),
                                    IsActive       = true,
                                    IsDeleted      = false,
                                    CorporateId    = Convert.ToInt32(m.CorporateId),
                                    CreatedBy      = m.CreatedBy,
                                    CreatedDate    = m.CreatedDate
                                };
                                var isAdded = facilityRoleBal.SaveFacilityRoleIfNotExists(facilityRoleModel);
                                if (isAdded)
                                {
                                    transScope.Complete();
                                }
                            }
                        }
                    }


                    result = m.UserID;
                }
            }
            return(result);
        }
示例#45
0
    public void GenerateFile(TBTransferProduk TransferProduk)
    {
        //MEMBUAT FILE TRANSFER PRODUK
        FileTransferProduk FileTransferProduk = new FileTransferProduk
        {
            IDTransferProduk  = TransferProduk.IDTransferProduk,
            EnumJenisTransfer = TransferProduk.EnumJenisTransfer,
            TanggalDaftar     = TransferProduk.TanggalDaftar,
            TanggalKirim      = TransferProduk.TanggalKirim,
            TanggalTerima     = TransferProduk.TanggalTerima,
            TanggalUpdate     = TransferProduk.TanggalUpdate,
            Keterangan        = TransferProduk.Keterangan,

            FileTempatPengirim = new FileTempat
            {
                Alamat                   = TransferProduk.TBTempat.Alamat,
                BiayaTambahan1           = TransferProduk.TBTempat.BiayaTambahan1,
                BiayaTambahan2           = TransferProduk.TBTempat.BiayaTambahan2,
                BiayaTambahan3           = TransferProduk.TBTempat.BiayaTambahan3,
                BiayaTambahan4           = TransferProduk.TBTempat.BiayaTambahan4,
                Email                    = TransferProduk.TBTempat.Email,
                EnumBiayaTambahan1       = TransferProduk.TBTempat.EnumBiayaTambahan1,
                EnumBiayaTambahan2       = TransferProduk.TBTempat.EnumBiayaTambahan2,
                EnumBiayaTambahan3       = TransferProduk.TBTempat.EnumBiayaTambahan3,
                EnumBiayaTambahan4       = TransferProduk.TBTempat.EnumBiayaTambahan4,
                FooterPrint              = TransferProduk.TBTempat.FooterPrint,
                IDKategoriTempat         = TransferProduk.TBTempat.IDKategoriTempat,
                IDStore                  = TransferProduk.TBTempat.IDStore,
                IDWMS                    = TransferProduk.TBTempat._IDWMS,
                KeteranganBiayaTambahan1 = TransferProduk.TBTempat.KeteranganBiayaTambahan1,
                KeteranganBiayaTambahan2 = TransferProduk.TBTempat.KeteranganBiayaTambahan2,
                KeteranganBiayaTambahan3 = TransferProduk.TBTempat.KeteranganBiayaTambahan3,
                KeteranganBiayaTambahan4 = TransferProduk.TBTempat.KeteranganBiayaTambahan4,
                Kode          = TransferProduk.TBTempat.Kode,
                Latitude      = TransferProduk.TBTempat.Latitude,
                Longitude     = TransferProduk.TBTempat.Longitude,
                Nama          = TransferProduk.TBTempat.Nama,
                TanggalDaftar = TransferProduk.TBTempat._TanggalInsert,
                TanggalUpdate = TransferProduk.TBTempat._TanggalUpdate,
                Telepon1      = TransferProduk.TBTempat.Telepon1,
                Telepon2      = TransferProduk.TBTempat.Telepon2
            },

            FileTempatPenerima = new FileTempat
            {
                Alamat                   = TransferProduk.TBTempat1.Alamat,
                BiayaTambahan1           = TransferProduk.TBTempat1.BiayaTambahan1,
                BiayaTambahan2           = TransferProduk.TBTempat1.BiayaTambahan2,
                BiayaTambahan3           = TransferProduk.TBTempat1.BiayaTambahan3,
                BiayaTambahan4           = TransferProduk.TBTempat1.BiayaTambahan4,
                Email                    = TransferProduk.TBTempat1.Email,
                EnumBiayaTambahan1       = TransferProduk.TBTempat1.EnumBiayaTambahan1,
                EnumBiayaTambahan2       = TransferProduk.TBTempat1.EnumBiayaTambahan2,
                EnumBiayaTambahan3       = TransferProduk.TBTempat1.EnumBiayaTambahan3,
                EnumBiayaTambahan4       = TransferProduk.TBTempat1.EnumBiayaTambahan4,
                FooterPrint              = TransferProduk.TBTempat1.FooterPrint,
                IDKategoriTempat         = TransferProduk.TBTempat1.IDKategoriTempat,
                IDStore                  = TransferProduk.TBTempat1.IDStore,
                IDWMS                    = TransferProduk.TBTempat1._IDWMS,
                KeteranganBiayaTambahan1 = TransferProduk.TBTempat1.KeteranganBiayaTambahan1,
                KeteranganBiayaTambahan2 = TransferProduk.TBTempat1.KeteranganBiayaTambahan2,
                KeteranganBiayaTambahan3 = TransferProduk.TBTempat1.KeteranganBiayaTambahan3,
                KeteranganBiayaTambahan4 = TransferProduk.TBTempat1.KeteranganBiayaTambahan4,
                Kode          = TransferProduk.TBTempat1.Kode,
                Latitude      = TransferProduk.TBTempat1.Latitude,
                Longitude     = TransferProduk.TBTempat1.Longitude,
                Nama          = TransferProduk.TBTempat1.Nama,
                TanggalDaftar = TransferProduk.TBTempat1._TanggalInsert,
                TanggalUpdate = TransferProduk.TBTempat1._TanggalUpdate,
                Telepon1      = TransferProduk.TBTempat1.Telepon1,
                Telepon2      = TransferProduk.TBTempat1.Telepon2
            },

            TransferProdukDetails = TransferProduk.TBTransferProdukDetails.Select(item => new FileTransferProdukDetail
            {
                Kode                 = item.TBKombinasiProduk.KodeKombinasiProduk,
                Produk               = item.TBKombinasiProduk.TBProduk.Nama,
                Atribut              = item.TBKombinasiProduk.TBAtributProduk.Nama,
                KombinasiProduk      = item.TBKombinasiProduk.Nama,
                Warna                = item.TBKombinasiProduk.TBProduk.TBWarna.Nama,
                Kategori             = item.TBKombinasiProduk.TBProduk.TBRelasiProdukKategoriProduks.Count > 0 ? item.TBKombinasiProduk.TBProduk.TBRelasiProdukKategoriProduks.FirstOrDefault().TBKategoriProduk.Nama : "",
                PemilikProduk        = item.TBKombinasiProduk.TBProduk.TBPemilikProduk.Nama,
                TanggalDaftar        = item.TBKombinasiProduk.TanggalDaftar.HasValue ? item.TBKombinasiProduk.TanggalDaftar.Value : DateTime.Now,
                TanggalUpdate        = item.TBKombinasiProduk.TanggalUpdate.HasValue ? item.TBKombinasiProduk.TanggalUpdate.Value : DateTime.Now,
                Berat                = item.TBKombinasiProduk.Berat.HasValue ? item.TBKombinasiProduk.Berat.Value : 0,
                Jumlah               = item.Jumlah,
                HargaBeli            = item.HargaBeli,
                HargaJual            = item.HargaJual,
                PersentaseKonsinyasi = item.TBKombinasiProduk.TBStokProduks.FirstOrDefault(item2 => item2.IDTempat == item.TBTransferProduk.IDTempatPengirim).PersentaseKonsinyasi.Value,
                Keterangan           = item.TBKombinasiProduk.Deskripsi
            }).ToList(),

            FilePenggunaPengirim = new FilePengguna
            {
                IDGrupPengguna = TransferProduk.TBPengguna.IDGrupPengguna,
                NamaLengkap    = TransferProduk.TBPengguna.NamaLengkap,
                Password       = TransferProduk.TBPengguna.Password,
                PIN            = TransferProduk.TBPengguna.PIN,
                Status         = TransferProduk.TBPengguna._IsActive,
                Username       = TransferProduk.TBPengguna.Username
            }
        };

        string Folder = HttpContext.Current.Server.MapPath("~/Files/Transfer Produk/Transfer/");

        if (!Directory.Exists(Folder))
        {
            Directory.CreateDirectory(Folder);
        }

        string NamaFile    = TransferProduk.TBTempat.Nama + " " + TransferProduk.IDTransferProduk + " " + (TransferProduk.TanggalKirim).ToString("d MMMM yyyy HH.mm") + ".WIT";
        string ExtensiFile = ".zip";
        string Path        = Folder + NamaFile + ExtensiFile;
        string Json        = JsonConvert.SerializeObject(FileTransferProduk);

        File.WriteAllText(Path, Json);

        string Output = Folder + NamaFile + "_enc" + ExtensiFile;

        EncryptDecrypt.Encrypt(Path, Output);

        File.Delete(Path);
    }
示例#46
0
        public string SaveUpdatePaymentsAccounts(PaymentAccountsModel model)
        {
            string          msg = "";
            ShomaRMEntities db  = new ShomaRMEntities();

            string encrytpedCardNumber    = model.CardNumber == null? "" : new EncryptDecrypt().EncryptText(model.CardNumber);
            string encrytpedAccountNumber = model.AccountNumber == null ? "" : new EncryptDecrypt().EncryptText(model.AccountNumber);
            string encrytpedCardMonth     = new EncryptDecrypt().EncryptText(model.Month);
            string encrytpedCardYear      = new EncryptDecrypt().EncryptText(model.Year);
            string encrytpedRoutingNumber = model.RoutingNumber == null? "" : new EncryptDecrypt().EncryptText(model.RoutingNumber);

            if (model.PAID == 0)
            {
                var savePaymentAccounts = new tbl_PaymentAccounts()
                {
                    TenantId      = model.TenantId,
                    NameOnCard    = model.NameOnCard,
                    CardNumber    = encrytpedCardNumber,
                    Month         = encrytpedCardMonth,
                    Year          = encrytpedCardYear,
                    CardType      = model.CardType,
                    PayMethod     = model.PayMethod,
                    BankName      = model.BankName,
                    AccountName   = model.AccountName,
                    AccountNumber = encrytpedAccountNumber,
                    RoutingNumber = encrytpedRoutingNumber
                };
                db.tbl_PaymentAccounts.Add(savePaymentAccounts);
                db.SaveChanges();
                msg = "Payment Account Saved Successfully";
            }
            else
            {
                var updatePaymentAccounts = db.tbl_PaymentAccounts.Where(co => co.PAID == model.PAID).FirstOrDefault();
                if (updatePaymentAccounts != null)
                {
                    updatePaymentAccounts.TenantId = model.TenantId;
                    if (model.PayMethod == 1)
                    {
                        updatePaymentAccounts.AccountName = model.AccountName;
                        updatePaymentAccounts.NameOnCard  = model.NameOnCard;
                        updatePaymentAccounts.CardNumber  = encrytpedCardNumber;
                        updatePaymentAccounts.Month       = encrytpedCardMonth;
                        updatePaymentAccounts.Year        = encrytpedCardYear;
                        updatePaymentAccounts.CardType    = model.CardType;
                        updatePaymentAccounts.PayMethod   = model.PayMethod;

                        updatePaymentAccounts.BankName      = "";
                        updatePaymentAccounts.AccountNumber = "";
                        updatePaymentAccounts.RoutingNumber = "";
                    }
                    else if (model.PayMethod == 2)
                    {
                        updatePaymentAccounts.NameOnCard = "";
                        updatePaymentAccounts.CardNumber = "";
                        updatePaymentAccounts.Month      = "";
                        updatePaymentAccounts.Year       = "";
                        updatePaymentAccounts.CardType   = 0;

                        updatePaymentAccounts.PayMethod     = model.PayMethod;
                        updatePaymentAccounts.BankName      = model.BankName;
                        updatePaymentAccounts.AccountName   = model.AccountName;
                        updatePaymentAccounts.AccountNumber = encrytpedAccountNumber;
                        updatePaymentAccounts.RoutingNumber = encrytpedRoutingNumber;
                    }
                    db.SaveChanges();
                }
                msg = "Progress Update Successfully";
            }
            db.Dispose();
            return(msg);
        }
示例#47
0
        /// <summary>
        /// Decrypt an encrypted setting string
        /// </summary>
        /// <param name="encrypted">The string to decrypt</param>
        /// <returns>The decrypted string or an empty string if something went wrong</returns>
        internal static string DecryptString(string encrypted)
        {
            string decrypted = String.Empty;

            EncryptDecrypt Crypto = new EncryptDecrypt();
            try
            {
                decrypted = Crypto.Decrypt(encrypted);
            }
            catch (Exception)
            {
                WifiRemote.LogMessage("Could not decrypt config string!", LogType.Error);
                decrypted = null;
            }

            return decrypted;
        }
        public static string ReadRegistry(string Title, string keyName, EncryptionOptions encryptionOptions, string encryptionKey = "123")//ReadLocal  value to Reg
        {
            string t = "";

            if (EncryptionOptions.NoEncryption == encryptionOptions)
            {
                RegistryKey Test = Registry.CurrentUser.OpenSubKey(Title);
                try
                {
                    if (Test != null)
                    {
                        Test.OpenSubKey(keyName);
                        t = Test.GetValue(keyName).ToString();
                    }
                    else
                    {
                        t = null;
                    }
                    return(t);
                }
                catch (NullReferenceException)
                {
                    return(null);
                }
            }
            else if (EncryptionOptions.OnlyValue == encryptionOptions)
            {
                RegistryKey Test = Registry.CurrentUser.OpenSubKey(Title);
                try
                {
                    if (Test != null)
                    {
                        Test.OpenSubKey(keyName);
                        t = Test.GetValue(keyName).ToString();
                    }
                    else
                    {
                        t = null;
                    }
                    return(EncryptDecrypt.Decrypt(t, encryptionKey));
                }
                catch (NullReferenceException)
                {
                    return(null);
                }
            }
            else if (EncryptionOptions.KeyNameAndValue == encryptionOptions)
            {
                RegistryKey Test = Registry.CurrentUser.OpenSubKey(Title);
                try
                {
                    if (Test != null)
                    {
                        Test.OpenSubKey(EncryptDecrypt.Encrypt(keyName, encryptionKey));
                        t = Test.GetValue(EncryptDecrypt.Encrypt(keyName, encryptionKey)).ToString();
                    }
                    else
                    {
                        t = null;
                    }
                    return(EncryptDecrypt.Decrypt(t, encryptionKey));
                }
                catch (NullReferenceException)
                {
                    return(null);
                }
            }
            return(t);
        }
示例#49
0
        public JsonResult GetFilteredDates(string dateString, string listString, string clientId)
        {
            List <string> dates  = new List <string>();
            List <string> dates2 = new List <string>();

            try
            {
                JavaScriptSerializer serializer = new JavaScriptSerializer();
                dates  = serializer.Deserialize <List <string> >(dateString);
                dates2 = serializer.Deserialize <List <string> >(listString);
                Scheduler schedular = new FingerprintsModel.Scheduler();
                schedular.ClientId = (clientId == null || clientId == "") ? 0 : Convert.ToInt64(EncryptDecrypt.Decrypt64(clientId));
                schedular.StaffId  = new Guid(Session["UserID"].ToString());
                schedular.AgencyId = new Guid(Session["AgencyID"].ToString());

                dates = new HomevisitorData().GetFilteredDates(dates, dates2, schedular);
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
            }
            return(Json(dates, JsonRequestBehavior.AllowGet));
        }
        public static string ReadRegistryWithSubKey(string title, string subTitle, string keyName, EncryptionOptionsWithSubKey encryptionOptions, string DecryptionKey = "123")//Read a value to Reg
        {
            string temp;

            if (EncryptionOptionsWithSubKey.NoEncryption == encryptionOptions)
            {
                RegistryKey Test = Registry.CurrentUser.OpenSubKey(title + "\\" + subTitle);
                try
                {
                    if (Test != null)
                    {
                        Test.OpenSubKey(keyName);
                        temp = Test.GetValue(keyName).ToString();
                    }
                    else
                    {
                        temp = null;
                    }
                    return(temp);
                }
                catch (NullReferenceException)
                {
                    return(null);
                }
            }
            else if (EncryptionOptionsWithSubKey.OnlyValue == encryptionOptions)
            {
                RegistryKey Test = Registry.CurrentUser.OpenSubKey(title + "\\" + subTitle);
                try
                {
                    if (Test != null)
                    {
                        Test.OpenSubKey(keyName);
                        temp = Test.GetValue(keyName).ToString();
                    }
                    else
                    {
                        temp = null;
                    }
                    return(EncryptDecrypt.Decrypt(temp, DecryptionKey));
                }
                catch (NullReferenceException)
                {
                    return(null);
                }
            }
            else if (EncryptionOptionsWithSubKey.FullEncryption == encryptionOptions)
            {
                RegistryKey Test = Registry.CurrentUser.OpenSubKey(EncryptDecrypt.Encrypt(title, DecryptionKey) + "\\" + EncryptDecrypt.Encrypt(subTitle, DecryptionKey));
                try
                {
                    if (Test != null)
                    {
                        Test.OpenSubKey(EncryptDecrypt.Encrypt(keyName, DecryptionKey));
                        temp = Test.GetValue(EncryptDecrypt.Encrypt(keyName, DecryptionKey)).ToString();
                    }
                    else
                    {
                        temp = null;
                    }
                    return(EncryptDecrypt.Decrypt(temp, DecryptionKey));
                }
                catch (NullReferenceException)
                {
                    return(null);
                }
            }
            else if (EncryptionOptionsWithSubKey.SubKeyAndValue == encryptionOptions)
            {
                RegistryKey Test = Registry.CurrentUser.OpenSubKey(title + "\\" + EncryptDecrypt.Encrypt(subTitle, DecryptionKey));
                try
                {
                    if (Test != null)
                    {
                        Test.OpenSubKey(EncryptDecrypt.Encrypt(keyName, DecryptionKey));
                        temp = Test.GetValue(EncryptDecrypt.Encrypt(keyName, DecryptionKey)).ToString();
                    }
                    else
                    {
                        temp = null;
                    }
                    return(EncryptDecrypt.Decrypt(temp, DecryptionKey));
                }
                catch (NullReferenceException)
                {
                    return(null);
                }
            }
            return(null);
        }
 protected void Wizard1_FinishButtonClick(object sender, WizardNavigationEventArgs e)
 {
     DatabaseHandler obj = new DatabaseHandler();
     String customerUsername = Request.Cookies["Car-Trading"]["Username"].ToString();
     DataSet ds = obj.GetCustomerName(customerUsername);
     String customerName = ds.Tables[0].Rows[0]["CUSTOMER_FIRST_NAME"].ToString() + " " + ds.Tables[0].Rows[0]["CUSTOMER_LAST_NAME"].ToString();
     Label18.Text = customerName;
     ds = obj.GetCustomerAddressPhone(customerUsername);
     String customerAddress = ds.Tables[0].Rows[0]["CUSTOMER_ADDRESS"].ToString();
     Label19.Text = customerAddress;
     Label20.Text = ds.Tables[0].Rows[0]["CUSTOMER_PHONE_NUMBER"].ToString();
     Label22.Text = Label3.Text;
     Label23.Text = Label5.Text;
     Label24.Text = Label4.Text;
     Label25.Text = Label7.Text;
     Label26.Text = Label13.Text;
     Label27.Text = TextBox7.Text;
     Label28.Text = RadioButtonList1.Text;
     String carId = Request.QueryString["carId"].ToString();
     String sellerId = Request.QueryString["sellerId"].ToString();
     String customerId = Request.QueryString["customerId"].ToString();
     EncryptDecrypt obj1 = new EncryptDecrypt();
     carId = obj1.Decrypt(HttpUtility.UrlDecode(carId));
     sellerId = obj1.Decrypt(HttpUtility.UrlDecode(sellerId));
     customerId = obj1.Decrypt(HttpUtility.UrlDecode(customerId));
     String orderId = "ORD_" + DateTime.Now.Ticks.ToString();
     obj.InsertPendingOrder(orderId, customerId, carId, sellerId, RadioButtonList1.Text, customerAddress, TextBox7.Text);
     Label21.Text = orderId;
     Label29.Visible = true;
 }
示例#52
0
        public FacilitesModel GetFacilitiesModelDashboard(StaffDetails details, bool iscenterMgr = false)
        {
            FacilitesModel facilitiesModel = new FacilitesModel();

            facilitiesModel.FacilitiesDashboardList = new List <FacilitiesManagerDashboard>();
            try
            {
                using (_connection)
                {
                    if (_connection.State == ConnectionState.Open)
                    {
                        _connection.Close();
                    }

                    command.Parameters.Clear();
                    command.Parameters.Add(new SqlParameter("@AgencyId", details.AgencyId));
                    command.Parameters.Add(new SqlParameter("@userId", details.UserId));
                    command.Parameters.Add(new SqlParameter("@RoleId", details.RoleId));
                    command.Parameters.Add(new SqlParameter("@isCenterManager", iscenterMgr));
                    command.Connection  = _connection;
                    command.CommandType = CommandType.StoredProcedure;
                    // command.CommandText = "USP_FacilitiesManagerDashboard";
                    command.CommandText = "USP_FacilitiesManagerDashboardCount";
                    dataAdapter         = new SqlDataAdapter(command);
                    _dataset            = new DataSet();
                    dataAdapter.Fill(_dataset);
                    if (_dataset.Tables[0] != null)
                    {
                        if (_dataset.Tables[0].Rows.Count > 0)
                        {
                            facilitiesModel.FacilitiesDashboardList = (from DataRow dr in _dataset.Tables[0].Rows

                                                                       select new FacilitiesManagerDashboard
                            {
                                CenterId = Convert.ToInt64(dr["CenterId"]),
                                Enc_CenterId = EncryptDecrypt.Encrypt64(dr["CenterId"].ToString()),
                                CenterName = dr["CenterName"].ToString(),
                                OpenedWorkOrders = Convert.ToInt64(dr["OpenedWorkOrders"]),
                                InternalAssigned = Convert.ToInt64(dr["InternalAssignedWorkOrders"]),
                                ExternalAssigned = Convert.ToInt64(dr["ExternalAssignedWorkOrders"]),
                                CompletedWorkOrders = Convert.ToInt64(dr["CompletedWorkOrders"]),
                                TemporarilyFixedWorkOrders = Convert.ToInt64(dr["TemporarilyFixed"]),
                                AssignedHimself = Convert.ToInt64(dr["AssignedHimself"])
                            }).ToList();
                        }
                    }
                    if (_dataset.Tables[1] != null && _dataset.Tables[1].Rows.Count > 0)
                    {
                        if (_dataset.Tables[1].Rows.Count > 0)
                        {
                            facilitiesModel.StaffList = (from DataRow dr5 in _dataset.Tables[1].Rows
                                                         select new SelectListItem
                            {
                                Text = dr5["name"].ToString(),
                                Value = dr5["userid"].ToString()
                            }).ToList();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                clsError.WriteException(ex);
            }
            finally
            {
                dataAdapter.Dispose();
                command.Dispose();
                _dataset.Dispose();
            }
            return(facilitiesModel);
        }
    public static void DoChangeUser(string scrobbleUser_, string scrobblePassword_)
    {
      olduser = username;
      oldpass = password;
      if (username != scrobbleUser_)
      {
        queue.Save();
        queue = null;
        MD5Response = String.Empty;
        string tmpPass = String.Empty;
        try
        {
          EncryptDecrypt Crypter = new EncryptDecrypt();
          tmpPass = Crypter.Decrypt(scrobblePassword_);
        }
        catch (Exception ex)
        {
          Log.Warn("Audioscrobbler: warning on password decryption {0}", ex.Message);
        }
        username = scrobbleUser_;
        password = tmpPass;
        using (Settings xmlwriter = new MPSettings())
        {
          xmlwriter.SetValue("audioscrobbler", "user", username);
        }

        DoHandshake(true, HandshakeType.ChangeUser);
      }
    }
示例#54
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            #region GENERATE STORE KEY
            using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext())
            {
                StoreKey_Class ClassStoreKey = new StoreKey_Class(db, true);

                ClassStoreKey.Generate();

                EnumAlert enumAlert = ClassStoreKey.Validasi();

                if (enumAlert == EnumAlert.danger)
                {
                    LiteralWarning.Text = Alert_Class.Pesan(TipeAlert.Danger, ClassStoreKey.MessageDanger);
                }
                else if (enumAlert == EnumAlert.warning)
                {
                    LiteralWarning.Text = Alert_Class.Pesan(TipeAlert.Warning, ClassStoreKey.MessageWarning);
                }
                else
                {
                    LiteralWarning.Text = "";
                }
            }
            #endregion

            TextBoxUsername.Focus();

            if (Request.QueryString["do"] == "logout")
            {
                PenggunaLogin Pengguna = (PenggunaLogin)Session["PenggunaLogin"];

                if (Pengguna != null)
                {
                    //menambah LogPengguna tipe Logout : 2
                    LogPengguna.Tambah(2, Pengguna.IDPengguna);

                    //MENGHAPUS SESSION
                    Session.Abandon();

                    //MENGHAPUS COOKIES
                    Response.Cookies["WITEnterpriseSystem"].Value   = string.Empty;
                    Response.Cookies["WITEnterpriseSystem"].Expires = DateTime.Now.AddDays(-1);

                    if (Pengguna.PointOfSales == TipePointOfSales.Retail) //RETAIL KEMBALI KE HALAMAN LOGIN
                    {
                        Response.Cookies["WMSLogin"].Value   = string.Empty;
                        Response.Cookies["WMSLogin"].Expires = DateTime.Now.AddDays(-1);
                    }
                    else if (Pengguna.PointOfSales == TipePointOfSales.Restaurant) //RESTAURANT KEMBALI KE HALAMAN LOGIN PIN
                    {
                        //JIKA VALUE COOKIES ADA MELAKUKAN ENCRYPT
                        string[] value = EncryptDecrypt.Decrypt(Request.Cookies["WMSLogin"].Value).Split('|');

                        //AMBIL VALUE TANGGAL DAN TANGGAL HARI INI HARUS LEBIH KECIL DARI VALUE COOKIES
                        if (DateTime.Now <= value[0].ToDateTime())
                        {
                            Response.Redirect("LoginPIN.aspx");
                        }
                    }
                }
            }
            else
            {
                Redirect();
            }
        }
    }