예제 #1
0
        protected void btnUploadCsvClient_OnClick(object sender, EventArgs e)
        {
            if (this.gvCsvClient.Rows.Count <= 0)
            {
                return;
            }
            int num = 0;

            for (int index = 0; index < this.gvCsvClient.Rows.Count; ++index)
            {
                string      text1        = this.gvCsvClient.Rows[index].Cells[1].Text;
                string      text2        = this.gvCsvClient.Rows[index].Cells[3].Text;
                CheckBox    checkBox     = (CheckBox)this.gvCsvClient.Rows[index].FindControl("chk");
                Label       label1       = (Label)this.gvCsvClient.Rows[index].FindControl("lblFirstName");
                Label       label2       = (Label)this.gvCsvClient.Rows[index].FindControl("lblLastName");
                HiddenField hiddenField1 = (HiddenField)this.gvCsvClient.Rows[index].FindControl("hfStreet");
                HiddenField hiddenField2 = (HiddenField)this.gvCsvClient.Rows[index].FindControl("hfStreet2");
                HiddenField hiddenField3 = (HiddenField)this.gvCsvClient.Rows[index].FindControl("hfSecStreet");
                HiddenField hiddenField4 = (HiddenField)this.gvCsvClient.Rows[index].FindControl("hfSecStreet2");
                HiddenField hiddenField5 = (HiddenField)this.gvCsvClient.Rows[index].FindControl("hfBusPhone");
                HiddenField hiddenField6 = (HiddenField)this.gvCsvClient.Rows[index].FindControl("hfHomePhone");
                HiddenField hiddenField7 = (HiddenField)this.gvCsvClient.Rows[index].FindControl("hfMobPhone");
                HiddenField hiddenField8 = (HiddenField)this.gvCsvClient.Rows[index].FindControl("hfFax");
                HiddenField hiddenField9 = (HiddenField)this.gvCsvClient.Rows[index].FindControl("hfNotes");
                if (!string.IsNullOrEmpty(text1) && !string.IsNullOrEmpty(text2) && (checkBox.Checked && !this.CheckEmail(text2)))
                {
                    string str1;
                    string str2;
                    MembershipCreateStatus status;
                    do
                    {
                        str1 = Doyingo.GenerateCode(6);
                        str2 = Doyingo.GenerateCode(8);
                        Membership.CreateUser(str1.Trim(), str2, text2, "What's Your Email?", text2, true, out status);
                    }while (status != MembershipCreateStatus.Success);
                    Roles.AddUserToRole(str1.Trim(), "CompanyClient");
                    this.objCompanyMasterDT = this.objCompanyMasterBll.GetDataByCompanyID(int.Parse(this.hfCompanyID.Value));
                    int?iCurrencyID = new int?();
                    if (!string.IsNullOrEmpty(this.objCompanyMasterDT.Rows[0]["CurrencyID"].ToString()))
                    {
                        iCurrencyID = new int?(int.Parse(this.objCompanyMasterDT.Rows[0]["CurrencyID"].ToString()));
                    }
                    if (this.objCompanyClientMasterBll.AddCompanyClient(int.Parse(this.hfCompanyID.Value), text1, iCurrencyID, true, false, text2, label1.Text, label2.Text, hiddenField6.Value.Trim(), hiddenField7.Value.Trim(), true, str1.Trim(), hiddenField1.Value, hiddenField2.Value, new int?(), new int?(), new int?(), "", hiddenField3.Value, hiddenField4.Value, new int?(), new int?(), new int?(), "", new int?(), "[choose one]", hiddenField5.Value.Trim(), hiddenField8.Value, hiddenField9.Value, true, false, false) != 0)
                    {
                        ++num;
                        this.SendMail(str1.Trim(), str2, this.lblEmail.Text);
                    }
                }
            }
            this.Session["importClient"] = (object)num;
            this.Response.Redirect("~/BillTransact/CompanyClientMaster.aspx");
        }
예제 #2
0
 protected void btnUploadvCardClient_OnClick(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(this.lblOrganization.Text) && !string.IsNullOrEmpty(this.lblEmail.Text) && (this.chkImport.Checked && !this.CheckEmail(this.lblEmail.Text)))
     {
         string str1;
         string str2;
         MembershipCreateStatus status;
         do
         {
             str1 = Doyingo.GenerateCode(6);
             str2 = Doyingo.GenerateCode(8);
             Membership.CreateUser(str1.Trim(), str2, this.lblEmail.Text, "What's Your Email?", this.lblEmail.Text, true, out status);
         }while (status != MembershipCreateStatus.Success);
         Roles.AddUserToRole(str1.Trim(), "CompanyClient");
         string sOrganizationName = this.lblOrganization.Text.Trim();
         if (string.IsNullOrEmpty(sOrganizationName))
         {
             sOrganizationName = this.lblEmail.Text.Trim();
         }
         string[] strArray   = this.lblName.Text.Split(' ');
         string   sLastName  = "";
         string   sFirstName = "";
         if (strArray.Length >= 0)
         {
             sFirstName = strArray[0];
         }
         if (strArray.Length >= 1)
         {
             sLastName = strArray[1];
         }
         this.objCompanyMasterDT = this.objCompanyMasterBll.GetDataByCompanyID(int.Parse(this.hfCompanyID.Value));
         int?iCurrencyID = new int?();
         if (!string.IsNullOrEmpty(this.objCompanyMasterDT.Rows[0]["CurrencyID"].ToString()))
         {
             iCurrencyID = new int?(int.Parse(this.objCompanyMasterDT.Rows[0]["CurrencyID"].ToString()));
         }
         if (this.objCompanyClientMasterBll.AddCompanyClient(int.Parse(this.hfCompanyID.Value), sOrganizationName, iCurrencyID, true, false, this.lblEmail.Text, sFirstName, sLastName, this.hfHome.Value.Trim(), this.hfMobile.Value.Trim(), true, str1.Trim(), "", "", new int?(), new int?(), new int?(), "", "", "", new int?(), new int?(), new int?(), "", new int?(), "[choose one]", this.hfWork.Value.Trim(), "", "Imported from vCard", true, false, false) == 0)
         {
             return;
         }
         this.SendMail(str1.Trim(), str2, this.lblEmail.Text);
         this.Session["importClient"] = (object)1;
         this.Response.Redirect("~/BillTransact/CompanyClientMaster.aspx");
     }
     else
     {
         this.mvvCard.SetActiveView(this.vCardFile);
         this.divError.Visible = true;
         this.lblError.Text    = "Some Error Occured. So Cant Import Your Client.";
     }
 }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Master == null)
            {
                return;
            }
            ((HtmlControl)this.Master.FindControl("reports")).Attributes.Add("class", "active open");
            MembershipUser user = Membership.GetUser();

            if (user != null)
            {
                string str = user.ToString();
                if (Roles.IsUserInRole(str, "Admin"))
                {
                    this.objCompanyLoginMasterDT = this.objCompanyLoginMasterBll.GetDataByCompanyLoginName(str);
                    if (this.objCompanyLoginMasterDT.Rows.Count > 0)
                    {
                        this.hfCompanyID.Value = this.objCompanyLoginMasterDT.Rows[0]["CompanyID"].ToString();
                    }
                }
                else if (Roles.IsUserInRole(str, "Employee"))
                {
                    this.objStaffMasterDT = this.objStaffMasterBll.GetDataByStaffUserName(str);
                    if (this.objStaffMasterDT.Rows.Count > 0)
                    {
                        this.hfCompanyID.Value = this.objStaffMasterDT.Rows[0]["CompanyID"].ToString();
                    }
                }
                this.imgLogo.ImageUrl = Doyingo.SetCompanyLogo(this.hfCompanyID.Value);
                this.SetMiscValues(this.hfCompanyID.Value);
            }
            if (this.IsPostBack)
            {
                return;
            }
            DateTime dateTime = new DateTime(DateTime.Now.Year, 1, 1);
            DateTime now      = DateTime.Now;

            this.txtDateFrom.Text     = dateTime.ToString(this.dateFormat);
            this.txtDateTo.Text       = now.ToString(this.dateFormat);
            this.ceDateFrom.StartDate = new DateTime?(DateTime.Now);
            this.BindGrid();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Master == null)
            {
                return;
            }
            ((HtmlControl)this.Master.FindControl("reports")).Attributes.Add("class", "active open");
            if (!this.IsPostBack)
            {
                this.ddlMonth.SelectedValue = DateTime.Now.Month.ToString();
                this.ddlYear.Items.Add(new ListItem(DateTime.Now.Year.ToString(), DateTime.Now.Year.ToString()));
                this.ddlYear.SelectedValue = DateTime.Now.Year.ToString();
                this.BindGrid();
            }
            MembershipUser user = Membership.GetUser();

            if (user == null)
            {
                return;
            }
            string str = user.ToString();

            if (Roles.IsUserInRole(str, "Admin"))
            {
                this.objCompanyLoginMasterDT = this.objCompanyLoginMasterBll.GetDataByCompanyLoginName(str);
                if (this.objCompanyLoginMasterDT.Rows.Count > 0)
                {
                    this.hfCompanyID.Value = this.objCompanyLoginMasterDT.Rows[0]["CompanyID"].ToString();
                }
            }
            else if (Roles.IsUserInRole(str, "Employee"))
            {
                this.objStaffMasterDT = this.objStaffMasterBll.GetDataByStaffUserName(str);
                if (this.objStaffMasterDT.Rows.Count > 0)
                {
                    this.hfCompanyID.Value = this.objStaffMasterDT.Rows[0]["CompanyID"].ToString();
                }
            }
            this.imgLogo.ImageUrl = Doyingo.SetCompanyLogo(this.hfCompanyID.Value);
            this.SetMiscValues(this.hfCompanyID.Value);
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.Master == null)
            {
                return;
            }
            ((HtmlControl)this.Master.FindControl("reports")).Attributes.Add("class", "active open");
            if (!this.IsPostBack)
            {
                this.ddlYear.Items.AddRange(Enumerable.ToArray <ListItem>(Enumerable.Select <int, ListItem>(Enumerable.Range(DateTime.Now.Year - 12, 13), (Func <int, ListItem>)(enumerable => new ListItem(enumerable.ToString((IFormatProvider)CultureInfo.InvariantCulture))))));
                this.ddlYear.SelectedIndex = this.ddlYear.Items.IndexOf(this.ddlYear.Items.FindByText(DateTime.Now.Year.ToString((IFormatProvider)CultureInfo.InvariantCulture)));
                this.BindGrid();
            }
            MembershipUser user = Membership.GetUser();

            if (user == null)
            {
                return;
            }
            string str = user.ToString();

            if (Roles.IsUserInRole(str, "Admin"))
            {
                this.objCompanyLoginMasterDT = this.objCompanyLoginMasterBll.GetDataByCompanyLoginName(str);
                if (this.objCompanyLoginMasterDT.Rows.Count > 0)
                {
                    this.hfCompanyID.Value = this.objCompanyLoginMasterDT.Rows[0]["CompanyID"].ToString();
                    this.imgLogo.ImageUrl  = Doyingo.SetCompanyLogo(this.hfCompanyID.Value);
                }
            }
            else if (Roles.IsUserInRole(str, "Employee"))
            {
                this.objStaffMasterDT = this.objStaffMasterBll.GetDataByStaffUserName(str);
                if (this.objStaffMasterDT.Rows.Count > 0)
                {
                    this.hfCompanyID.Value = this.objStaffMasterDT.Rows[0]["CompanyID"].ToString();
                    this.imgLogo.ImageUrl  = Doyingo.SetCompanyLogo(this.hfCompanyID.Value);
                }
            }
            this.SetMiscValues(this.hfCompanyID.Value);
        }