Exemplo n.º 1
0
        void login()
        {
            String ZipRegex = "^[0-9]+$";

            GetItemData objadditemdata = new GetItemData();
            ItemData    Objitemdata    = new ItemData();

            // DateTime datetime;
            cn = a.getconnection();

            String q = txtItemNo.Text;
            //String x = "select Item_no from Item_Manager";
            //SqlCommand cmd3 = new SqlCommand(x, cn);
            // SqlDataAdapter adp = new SqlDataAdapter(cmd3);
            DataSet ds = dal.getdataset("select Item_no from Item_Manager");
            // adp.Fill(ds);
            int count = ds.Tables[0].Rows.Count;

            for (i = 0; i < count; i++)
            {
                String z = ds.Tables[0].Rows[i].ItemArray[0].ToString();
                if (string.Equals(q, z, StringComparison.CurrentCultureIgnoreCase))
                {
                    lblerror.Visible = true;
                    lblerror.Text    = "Item No. Already Exist ..!";
                    lblerr2.Visible  = true;
                    throw new Exception();
                }
            }

            String q1 = txtlogednric.Text;
            // String x1 = "select NRICno from UserInformation";
            // SqlCommand cmd4 = new SqlCommand(x1, cn);
            // SqlDataAdapter adp4 = new SqlDataAdapter(cmd4);
            DataSet ds4 = dal.getdataset("select NRICno from UserInformation");
            //adp4.Fill(ds4);
            int count1 = ds4.Tables[0].Rows.Count;

            for (i = 0; i < count1; i++)
            {
                String z1 = ds4.Tables[0].Rows[i].ItemArray[0].ToString();
                if (string.Equals(q1, z1, StringComparison.CurrentCultureIgnoreCase))
                {
                    //Objitemdata.Item_no = txtItemNo.Text;
                    //Objitemdata.Item_Description = txtItemdescription.Text;
                    //Objitemdata.Item_quantity = txtItemquantity.Text;

                    //Objitemdata.loged_Nric = txtlogednric.Text;
                    //Objitemdata.loged_Name = txtlogedname.Text;
                    //Objitemdata.loged_CompName = txtlogedcompname.Text;
                    //Objitemdata.loged_Time =DateTime.Now;

                    //Objitemdata.Found_Nric = txtfoundnric.Text;
                    //Objitemdata.Status = cmbstatus.Text;
                    //Objitemdata.Found_Time = DateTime.Now;


                    AdminBLL ws = new AdminBLL();
                    ws.AddItem(Objitemdata);
                    UpdateAutogenCode();

                    HttpContext.Current.Items.Add("COMPLETE", "INSERT");
                    Server.Transfer("..//SMSADMIN//AlertUpdateComplete.aspx");
                }
            }

            lblerror.Visible = true;
            lblerror.Text    = "Invalid NRIC/FIN No. ..!";
            lblerr1.Visible  = true;
        }