示例#1
0
        public List<string> GetAllPredictions(string keywordStartsWith)
        {
            //StringBuilder sb = new StringBuilder();
            List<string> output = new List<string>();
            using (App_Data.DataClassesERPDataContext db = new App_Data.DataClassesERPDataContext())
            {
                var query =
                   from ord in db.partnos
                   //where ord.part_no.StartsWith(keywordStartsWith)
                   where SqlMethods.Like(ord.part_no, "%" + keywordStartsWith + "%") & ord.@operator==Global.UserEntityID.ToString()
                   select ord;

                // Execute the query, and change the column values
                // you want to change.
                //foreach (App_Data.partno ord in query)
                foreach (var ord in query)
                {
                    output.Add(ord.part_no.Trim()+"-"+ord.part_name.Trim());
                }

                //return Convert.ToString(sb);
            }
            ////TODO: implement real search here!

            //// dummy implementation
            // IList<string> output = new List<string>();
            // output = sb.ToString().Split('|');
            //output.Add(keywordStartsWith + "1");
            //output.Add(keywordStartsWith + "2");
            //output.Add(keywordStartsWith + "3");
            //output.Add(keywordStartsWith + "4");
            return output;
        }
示例#2
0
        public void UserActive(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "UserActive")
            {
                using (App_Data.DataClassesERPDataContext erpdb = new App_Data.DataClassesERPDataContext())
                {
                    int index = Convert.ToInt32(e.CommandArgument);
                    string userstmp = GridView1.DataKeys[index].Value.ToString();
                    LblID.Text = userstmp;
                    var UserData = from u in erpdb.aspnet_Users
                                   join m in erpdb.aspnet_Memberships on u.UserId equals m.UserId
                                   where u.UserId.ToString() == userstmp
                                   select new
                                   {
                                       user_code = u.UserName,
                                       email = m.Email,
                                       last_login_date = m.LastLoginDate,
                                       register_date = m.CreateDate,
                                       active_flag = u.MobileAlias
                                   };

                    foreach (var ud in UserData)
                    {
                        txtLoginName.Text = ud.user_code;
                        txtEmail.Text = ud.email;
                    }
                }

                MultiView1.ActiveViewIndex = 1;
            }
        }
示例#3
0
 protected void getCnameInfo(string tCname)
 {
     using (App_Data.DataClassesERPDataContext db = new App_Data.DataClassesERPDataContext())
     {
         var whreceipt = (from whc in db.erpclients
                          where whc.cname_code == tCname && whc.@operator == Global.UserEntityID.ToString()
                          select whc).Single();
         LblCustomerName.Text = whreceipt.cname;
         LblCustomerAddress.Text = whreceipt.address + " " + whreceipt.city;
     }
 }
示例#4
0
 protected void Load_DetailsView(string TransFeeID)
 {
     using (App_Data.DataClassesERPDataContext erpdb = new App_Data.DataClassesERPDataContext())
     {
         var allPartNo = from c in erpdb.erpclients
                         where c.cname_code == TransFeeID
                         select c;
         FormView1.DataSource = allPartNo;
         FormView1.DataBind();
     }
 }
示例#5
0
 protected void LoadCategories()
 {
     using (App_Data.DataClassesERPDataContext db = new App_Data.DataClassesERPDataContext())
     {
         var categories = from c in db.categories
                          where c.@operator == Global.UserEntityID.ToString()
                          select new { tmpValue = c.id_num,tmpText = c.category_name};
         DropDownListcategory.DataSource = categories;
         DropDownListcategory.DataTextField = "tmpText";
         DropDownListcategory.DataValueField = "tmpValue";
         DropDownListcategory.DataBind();
     }
 }
示例#6
0
 protected void Load_GridView()
 {
     string tmpUserCode = Global.UserEntityID.ToString();
     string tmpsearchbox = txbSearchKeyword.Text.Trim().ToString() + "%";
     using (App_Data.DataClassesERPDataContext erpdb = new App_Data.DataClassesERPDataContext())
     {
         var allPartNo = from c in erpdb.warehouses
                         where SqlMethods.Like(c.part_no, tmpsearchbox) & c.@operator == tmpUserCode & c.qty > 0
                         orderby c.part_no
                         select c;
         GridView1.DataSource = allPartNo;
         GridView1.DataBind();
     }
 }
示例#7
0
        private void GetUserMenu()
        {
            xmlDataSource.Data = null;
            using (App_Data.DataClassesERPDataContext erpdb = new App_Data.DataClassesERPDataContext())
            {
                var allClient = from c in erpdb.users_infos
                                where c.users_code == Global.UserCode
                                select c;
                foreach (var ac in allClient)
                {
                    Global.UserEntityID = ac.Entity_id.Value;
                }
            }

            // MembershipUser tLoginUser = Membership.GetUser(HttpContext.Current.User.Identity.Name);
            //if (Page.User.Identity.IsAuthenticated == true)
            //{
            //string userEntityID = "500";
            DataSet ds = new DataSet();
            //string connStr = "server=localhost;Trusted_Connection=true;database=MenuDb";
            string connStr = ConfigurationManager.ConnectionStrings["erpdbConnectionString"].ConnectionString;
            using (SqlConnection conn = new SqlConnection(connStr))
            {
                string sql = "Select menu_id as 'MenuID',menu_name as 'Text',menu_description as 'Description',url as'Url',partent_id as 'ParentID' from user_menu where users_entity = " + Global.UserEntityID;
                //string sql = "Select MenuID, Text, Url,Description, ParentID from Menu";
                SqlDataAdapter da = new SqlDataAdapter(sql, conn);
                da.Fill(ds);
                da.Dispose();
            }
            ds.DataSetName = "Menus";
            ds.Tables[0].TableName = "Menu";
            DataRelation relation = new DataRelation("ParentChild",
                    ds.Tables["Menu"].Columns["MenuID"],
                    ds.Tables["Menu"].Columns["ParentID"],
                    true);

            relation.Nested = true;
            ds.Relations.Add(relation);

            xmlDataSource.Data = ds.GetXml();
        }
示例#8
0
 protected void BindData()
 {
     string tmpUserCode = Global.UserEntityID.ToString();
     using (App_Data.DataClassesERPDataContext db = new App_Data.DataClassesERPDataContext())
     {
         var whreceipt = from whc in db.invoices
                         where whc.@operator == tmpUserCode
                         group whc by whc.invoiceno into Group
                         select new { Group.Key, podate = Group.Max(whc => whc.invoicedate) };
         int test = whreceipt.Count();
         if (test > 0)
         {
             GridView1.DataSource = whreceipt;
             GridView1.DataBind();
         }
         else
         {
             GridView1.DataSource = null;
             GridView1.DataBind();
         }
     }
 }
示例#9
0
 protected void get_dropdownlist_users()
 {
     using (App_Data.DataClassesERPDataContext erpdb = new App_Data.DataClassesERPDataContext())
     {
         var users = from user in erpdb.users_infos
                     orderby user.users_name
                     select new { users_name = user.users_name, users_code = user.users_code };
         DropDownListUsers.DataSource = users;
         DropDownListUsers.DataTextField = "users_code";
         DropDownListUsers.DataValueField = "users_code";
         DropDownListUsers.DataBind();
     }
 }
示例#10
0
        protected void Load_GridView()
        {
            string tmpUserCode = Global.UserEntityID.ToString();
            using (App_Data.DataClassesERPDataContext erpdb = new App_Data.DataClassesERPDataContext())
            {
                var allClient = from c in erpdb.users_infos
                                orderby c.users_code
                                select c;

                GridView1.DataSource = allClient;
                GridView1.DataBind();
            }
        }
示例#11
0
        protected void Load_DetailsView(string TransFeeID)
        {
            using (App_Data.DataClassesERPDataContext erpdb = new App_Data.DataClassesERPDataContext())
            {
                var SingleUser = from c in erpdb.users_infos
                                 where c.users_code == TransFeeID // & c.@operator == Global.UserEntityID.ToString()
                                 select c;

                FormView1.DataSource = SingleUser;
                FormView1.DataBind();
            }
        }
示例#12
0
        protected string LoadPartnos()
        {
            StringBuilder sb = new StringBuilder();
            using (App_Data.DataClassesERPDataContext db = new App_Data.DataClassesERPDataContext())
            {
                var query =
                   from ord in db.partnos
                   where ord.@operator == Global.UserEntityID.ToString()
                   //where ord.part_no.StartsWith(PartialPartno)
                   select ord;

                // Execute the query, and change the column values
                // you want to change.
                foreach (App_Data.partno ord in query)
                {
                    sb.Append(Convert.ToString(ord.part_no.Trim()+"-"+ ord.part_name.Trim()+ "|"));
                }

                return Convert.ToString(sb);

            }
        }
示例#13
0
        protected void LoadDetails()
        {
            using (App_Data.DataClassesERPDataContext erpdb = new App_Data.DataClassesERPDataContext())
            {
                string userstmp = Global.UserCode.ToString();
                LblID.Text = userstmp;
                var UserData = from u in erpdb.users_infos
                               where u.users_code == userstmp
                               select u;

                foreach (var ud in UserData)
                {
                    txtLoginName.Text = ud.users_code;
                    txtEmail.Text = ud.email;
                    txtCompanyName.Text = ud.company_name;
                    txtCompanyPhone.Text = ud.company_phone;
                    txtCity.Text = ud.city;
                    txtUserID.Text = ud.user_id.ToString();
                }
            }
        }
示例#14
0
        protected void Load_DetailsView(string EntitynumberStr)
        {
            string tmpCnameCode;
            string tmpUserCode = Global.UserEntityID.ToString();
            using (App_Data.DataClassesERPDataContext db = new App_Data.DataClassesERPDataContext())
            {
                var whreceipt = from whc in db.invoices
                                where whc.invoiceno.ToString() == EntitynumberStr && whc.@operator == tmpUserCode
                                select whc;
                int test = whreceipt.Count();
                if (test > 0)
                {
                    gvSample.DataSource = whreceipt;
                    gvSample.DataBind();
                }
                else
                {
                    gvSample.DataSource = null;
                    gvSample.DataBind();
                }

                foreach (var tdate in whreceipt)
                {
                    Invoice_date.Text = tdate.invoicedate.ToString();
                    tmpCnameCode = tdate.cname_code;
                    getCnameInfo(tmpCnameCode);
                }

            }
        }
示例#15
0
        private void ModifyStatus(string userid)
        {
            using (App_Data.DataClassesERPDataContext erpdb = new App_Data.DataClassesERPDataContext())
            {
                var UserData = from u in erpdb.aspnet_Users
                               where u.UserId.ToString() == userid
                               select u;

                foreach (var ud in UserData)
                {
                    ud.MobileAlias = "Active";
                }

                try
                {
                    erpdb.SubmitChanges();
                }
                catch (Exception e)
                {
                    Message.Text = e.Message;
                    // Provide for exceptions.
                }
            }
        }
示例#16
0
        private string countryName()
        {
            StringBuilder sb = new StringBuilder();
            using (App_Data.DataClassesERPDataContext db = new App_Data.DataClassesERPDataContext())
            {
                var query =
                   from ord in db.partnos
                   //where ord.part_no == tmpPartno
                   select ord;

                // Execute the query, and change the column values
                // you want to change.
                foreach (App_Data.partno ord in query)
                {
                    sb.Append(Convert.ToString(ord.part_no.Trim() + "|"));
                }

                return Convert.ToString(sb);
            }
        }
示例#17
0
        protected void getInvoiceTitle()
        {
            try
            {
                using (App_Data.DataClassesERPDataContext db = new App_Data.DataClassesERPDataContext())
                {
                    var whreceipt = (from whc in db.users_infos
                                     where whc.users_code == Global.UserCode.ToString()
                                     select whc).Single();

                    LblENameO.Text = whreceipt.invoice_name;
                    LblAddressO.Text = whreceipt.invoice_address;
                    LblPhoneO.Text = whreceipt.invoice_phone;
                }
            }
            catch (Exception e)
            {
                Message.Text = e.Message;
            }
        }
示例#18
0
        protected void Load_DetailsView(string TransFeeID)
        {
            using (App_Data.DataClassesERPDataContext erpdb = new App_Data.DataClassesERPDataContext())
            {
                var allPartNo = from c in erpdb.partnos
                                where c.part_no == TransFeeID & c.@operator == Global.UserEntityID.ToString()
                                select c;
                FormView1.DataSource = allPartNo;
                FormView1.DataBind();

                foreach (var tmpC in allPartNo)
                {
                    int tidnum = Convert.ToInt32(tmpC.category);
                    var allCategories = from cc in erpdb.categories
                                        where cc.id_num == tidnum
                                        select cc;
                    Label lblcategory = FormView1.FindControl("lblCategory") as Label;
                    if (lblcategory != null)
                    {
                        foreach (var cc in allCategories)
                        {
                            lblcategory.Text = cc.category_name;
                        }
                    }
                }
            }
        }
示例#19
0
 protected void Load_ErpClient()
 {
     string tmpsearchbox = client_code.Text.Trim().ToString();
     using (App_Data.DataClassesERPDataContext erpdb = new App_Data.DataClassesERPDataContext())
     {
         var allClient = from c in erpdb.erpclients
                         where c.cname_code == tmpsearchbox
                         orderby c.cname
                         select c;
         foreach (var tmpclient in allClient)
         {
             cname.Text = tmpclient.cname.Trim();
             cperson.Text = tmpclient.contact.Trim();
             txbTel.Text = tmpclient.tel.Trim();
             txbFax.Text = tmpclient.fax.Trim();
             saddress.InnerText = tmpclient.address.Trim();
             scity.Text = tmpclient.city.Trim();
             post_code.Text = tmpclient.postcode.Trim();
             email.Text = tmpclient.email.Trim();
             invoice_tax.Text = tmpclient.invoice_tax.ToString().Trim();
             website.Text = tmpclient.website.Trim();
             notes.InnerText = tmpclient.notes.Trim();
             CascadingDropDown1.SelectedValue = tmpclient.countryID.ToString().Trim();
             CascadingDropDown2.SelectedValue = tmpclient.locationID.ToString().Trim();
         }
     }
 }
示例#20
0
        private void get_DropDownListClient()
        {
            string tmp_country = DropDownListcountry.SelectedItem.Value.Trim();
            string tmp_region = DropDownListregion.SelectedItem.Value.Trim();

            if (tmp_region == null || tmp_region.Length == 0)
            { tmp_region = null; }
            DropDownListClient.DataSource = null;
            using (App_Data.DataClassesERPDataContext erpdb = new App_Data.DataClassesERPDataContext())
            {

                var ddregion = from rg in erpdb.erpclients
                               where rg.countryID.ToString() == tmp_country && rg.locationID.ToString() == tmp_region && rg.@operator == Global.UserEntityID.ToString()
                               orderby rg.cname
                               select new { rg.cname, rg.cname_code };
                if (ddregion != null)
                {
                    DropDownListClient.DataSource = ddregion;
                    DropDownListClient.DataTextField = "cname";
                    DropDownListClient.DataValueField = "cname_code";
                    DropDownListClient.DataBind();
                }
                else
                {
                    DropDownListClient.DataSource = null;
                    DropDownListClient.DataBind();
                }
            }
        }
示例#21
0
        protected void BindData()
        {
            string tmpUserCode = Global.UserEntityID.ToString();
            int tflag = 0;
            using (App_Data.DataClassesERPDataContext db = new App_Data.DataClassesERPDataContext())
            {
                var whreceipt = from whc in db.wh_receipts
                                where whc.whre_no == receipt_no.Text.ToString().Trim() && whc.@operator == tmpUserCode
                                select whc;
                int test = whreceipt.Count();
                foreach (App_Data.wh_receipt twhreceipt in whreceipt)
                {
                    if (twhreceipt.flag == "1")
                    {
                        tflag = 1;
                        Message.Text = "Do not use the exist NO.!";
                        break;
                    }
                }

                if (test > 0 && tflag == 0)
                {
                    GridView1.DataSource = whreceipt;
                    GridView1.DataBind();
                }
                else
                {
                    GridView1.DataSource = null;
                    GridView1.DataBind();
                }
            }
        }
示例#22
0
 protected void Load_DetailsView(string EntitynumberStr)
 {
     string tmpUserCode = Global.UserEntityID.ToString();
     using (App_Data.DataClassesERPDataContext db = new App_Data.DataClassesERPDataContext())
     {
         var whreceipt = from whc in db.cpos
                         where whc.cpono == EntitynumberStr && whc.@operator == tmpUserCode
                         select whc;
         int test = whreceipt.Count();
         if (test > 0)
         {
             GridView2.DataSource = whreceipt;
             GridView2.DataBind();
         }
         else
         {
             GridView2.DataSource = null;
             GridView2.DataBind();
         }
     }
 }
示例#23
0
 protected void GridviewBind()
 {
     using (App_Data.DataClassesERPDataContext erpdb = new App_Data.DataClassesERPDataContext())
     {
         var UserData = from u in erpdb.aspnet_Users
                        join m in erpdb.aspnet_Memberships on u.UserId equals m.UserId
                        orderby u.UserName
                        select new
                        {
                            user_id = u.UserId,
                            user_code = u.UserName,
                            email = m.Email,
                            last_login_date = m.LastLoginDate,
                            register_date = m.CreateDate,
                            active_flag = u.MobileAlias
                        };
         GridView1.DataSource = UserData;
         GridView1.DataBind();
     }
 }
示例#24
0
 private void Get_MaxINVNO()
 {
     using (App_Data.DataClassesERPDataContext erpdb = new App_Data.DataClassesERPDataContext())
     {
         string maxINVNo = (from inv in erpdb.invoices select inv.invoiceno.ToString()).Max();
         txbINV.Text = (Convert.ToInt32(maxINVNo) + 1).ToString();
     }
 }
示例#25
0
 protected void Load_GridView()
 {
     string tmpUserCode = Global.UserEntityID.ToString();
     string tmpPartNO = txbSearchKeyword.Text.Trim().ToString();
     string tmpsearchbox = "%" +shared.HelperMethods.GetPartNo(tmpPartNO) + "%";
     using (App_Data.DataClassesERPDataContext erpdb = new App_Data.DataClassesERPDataContext())
     {
         var allPartNo = from c in erpdb.partnos
                         where SqlMethods.Like(c.part_no, tmpsearchbox) & c.@operator == tmpUserCode
                         //where c.part_no.StartsWith(tmpsearchbox) & c.@operator == tmpUserCode
                         orderby c.part_no
                         select c;
         GridView1.DataSource = allPartNo;
         GridView1.DataBind();
     }
 }
示例#26
0
        protected void Load_GridView()
        {
            string tmpUserCode = Global.UserEntityID.ToString();
            string tmpsearchbox = txbSearchKeyword.Text.Trim().ToString() + "%";
            using (App_Data.DataClassesERPDataContext erpdb = new App_Data.DataClassesERPDataContext())
            {
                var allClient = from c in erpdb.erpclients
                                where SqlMethods.Like(c.cname, tmpsearchbox) & c.@operator == tmpUserCode
                                orderby c.cname
                                select c;

                GridView1.DataSource = allClient;
                GridView1.DataBind();
            }
        }