예제 #1
0
        private void btnUpdate_Click_1(object sender, EventArgs e)
        {
            try
            {
                DialogResult dialogResult = MessageBox.Show("Are you Sure you want to Update the Product Details?", "Agro", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    {
                        string insQuery = string.Empty;
                        string strQuery = string.Empty;
                        {
                            SelectTax();
                            strQuery = "update PRODUCT set PRODUCTNAME='" + txtPName.Text + "',CATID='" + CatId + "',TYPE='" + cmbTyp.Text + "',UNITCOST='" + txtUnitCost.Text + "',BARCODE='" + txtBarcode.Text + "',UNITPRICE='" + txtBarcode.Text + "',PACKQTY='" + txtPacketQty.Text + "',SELLQTY='" + txtSellQty.Text + "',TAX1='" + TAX_1 + "',TAX2='" + TAX_2 + "',QTYONHAND='" + txtQtyOnHand.Text + "',SUPPID='" + SupplId + "',ISTOREID='" + txtStoreId.Text + "',UPDATEDATE='" + strDateTime + "' where ID='" + txtPId.Text + "'  ";
                            dLib.ExecuteNonQuery(AgroFUN.gblConnString, strQuery);


                            ClearValue();
                        }
                    }
                }
            }


            catch (Exception ex)
            {
                AgroFUN.SystemLog("Save:" + ex.Message.ToString());
            }
        }
예제 #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                string strQuery = string.Empty;
                string strCat   = txtSettingName.Text.Trim();

                if (strCat.Length == 0)
                {
                    MessageBox.Show("Select Tax");
                    txtSettingName.Focus();
                    return;
                }
                DialogResult dialogResult = MessageBox.Show("Are you Sure you want to delete it?", "Agro", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    if (STORESETTINGNAME != "0")
                    {
                        strQuery = "DELETE FROM SETTING  where SETTINGNAME='" + STORESETTINGNAME + "'";
                        dLib.ExecuteNonQuery(AgroFUN.gblConnString, strQuery);
                        txtSettingName.Text = "";
                        STORESETTINGNAME    = "0";
                        txtSearch.Text      = "";
                        ClearValue();
                        txtSettingName.Focus();
                    }
                    LoadGrid();
                }
            }
            catch (Exception ex)
            {
                AgroFUN.SystemLog("DELETE:" + ex.Message.ToString());
            }
        }
예제 #3
0
        private void btnAdd_Click_1(object sender, EventArgs e)
        {
            try
            {
                if (cmbTyp.Text == "Lot Matrix")
                {
                    string strQuery = string.Empty;
                    {
                        SelectTax();
                        strQuery = "insert into PRODUCT(ID,PRODUCTNAME,CATID,TYPE,UNITCOST,BARCODE,UNITPRICE,PACKQTY,SELLQTY,TAX1,TAX2,QTYONHAND,SUPPID,ISTOREID,CREATEDATE) values ('" + txtPId.Text + "','" + txtPName.Text + "','" + CatId + "','" + cmbTyp.Text + "','" + txtUnitCost.Text + "','" + txtBarcode.Text + "','" + txtUnitPrice.Text + "','" + txtPacketQty.Text + "','" + txtSellQty.Text + "','" + TAX_1 + "','" + TAX_2 + "','" + txtQtyOnHand.Text + "','" + SupplId + "','" + txtStoreId.Text + "','" + strDateTime + "')";
                        dLib.ExecuteNonQuery(AgroFUN.gblConnString, strQuery);
                        LoadGrid();
                    }
                    tabControl1.SelectedTab = tabPage2;
                }
                else
                {
                    string strQuery = string.Empty;
                    {
                        SelectTax();
                        strQuery = "insert into PRODUCT(ID,PRODUCTNAME,CATID,TYPE,UNITCOST,BARCODE,UNITPRICE,PACKQTY,SELLQTY,TAX1,TAX2,QTYONHAND,SUPPID,ISTOREID,CREATEDATE) values ('" + txtPId.Text + "','" + txtPName.Text + "','" + CatId + "','" + cmbTyp.Text + "','" + txtUnitCost.Text + "','" + txtBarcode.Text + "','" + txtUnitPrice.Text + "','" + txtPacketQty.Text + "','" + txtSellQty.Text + "','" + TAX_1 + "','" + TAX_2 + "','" + txtQtyOnHand.Text + "','" + SupplId + "','" + txtStoreId.Text + "','" + strDateTime + "')";
                        dLib.ExecuteNonQuery(AgroFUN.gblConnString, strQuery);

                        ClearValue();
                    }
                }
                //  ClearValue();
            }

            catch (Exception ex)
            {
                AgroFUN.SystemLog("Save:" + ex.Message.ToString());
            }
        }
예제 #4
0
        private bool CheckValidation(string vType = "ADD")
        {
            bool ckhValid = true;

            try
            {
                string strCat = txtSettingName.Text.Trim();
                if (strCat.Length == 0)
                {
                    MessageBox.Show("Enter Code");
                    txtSettingName.Focus();
                    return(false);
                }


                if (vType == "ADD")
                {
                    if (dLib.CheckRecordExist(AgroFUN.gblConnString, "select SETTINGNAME from SETTING where lower(SETTINGNAME)='" + strCat.ToLower() + "'"))
                    {
                        MessageBox.Show("Tax Code allredy Exist");
                        txtSettingName.Focus();
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                AgroFUN.SystemLog("CHEK CAT:" + ex.Message.ToString());
            }

            return(ckhValid);
        }
예제 #5
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                string strQuery = string.Empty;
                string strCat   = txtTenderName.Text.Trim();

                if (strCat.Length == 0)
                {
                    MessageBox.Show("Select USER");
                    txtTenderName.Focus();
                    return;
                }
                DialogResult dialogResult = MessageBox.Show("Are you Sure you want to delete it?", "Agro", MessageBoxButtons.YesNo);
                if (dialogResult == DialogResult.Yes)
                {
                    if (TENDERID != 0)
                    {
                        strQuery = "DELETE FROM TENDERTYPE  where ID=" + TENDERID;
                        dLib.ExecuteNonQuery(AgroFUN.gblConnString, strQuery);
                        txtTenderName.Text = "";
                        TENDERID           = 0;
                        txtSearch.Text     = "";
                        ClearValue();
                        txtTenderName.Focus();
                    }
                    LoadGrid();
                }
            }
            catch (Exception ex)
            {
                AgroFUN.SystemLog("DELETE:" + ex.Message.ToString());
            }
        }
예제 #6
0
        private void LoadGrid()
        {
            try
            {
                string strLoad = string.Empty;
                string strCat  = txtSearch.Text.Trim();

                if (strCat.Length == 0)
                {
                    strLoad = "SELECT P.ID,P.PRODUCTNAME,C.CATNAME,P.TYPE,P.UNITCOST,P.BARCODE,P.UNITPRICE,P.PACKQTY,P.SELLQTY,P.TAX1,P.TAX2,P.QTYONHAND,P.SUPPID,P.ISTOREID,P.CREATEDATE,P.UPDATEDATE FROM PRODUCT AS P LEFT JOIN CATEGORY AS C ON P.CATID = C.ID";
                }
                else
                {
                    //  strLoad = "SELECT P.ID,P.PRODUCTNAME,C.CATNAME,P.TYPE,P.UNITCOST,P.BARCODE,P.UNITPRICE,P.PACKQTY,P.SELLQTY,P.TAX1,P.TAX2,P.QTYONHAND,P.SUPPID,P.ISTOREID,P.CREATEDATE,P.UPDATEDATE FROM PRODUCT AS P LEFT JOIN CATEGORY AS C ON P.CATID = C.ID WHERE P.PRODUCTNAME='"+strCat+"'";
                    strLoad = "SELECT P.ID,P.PRODUCTNAME,C.CATNAME,P.TYPE,P.UNITCOST,P.BARCODE,P.UNITPRICE,P.PACKQTY,P.SELLQTY,P.TAX1,P.TAX2,P.QTYONHAND,P.SUPPID,P.ISTOREID,P.CREATEDATE,P.UPDATEDATE FROM PRODUCT AS P LEFT JOIN CATEGORY AS C ON P.CATID = C.ID WHERE P.PRODUCTNAME LIKE '%" + strCat + "%' OR P.CREATEDATE LIKE'%" + strCat + "' OR P.UPDATEDATE LIKE'%" + strCat + "'";
                }

                DataTable dt = dLib.ExecuteDatTable(AgroFUN.gblConnString, strLoad);
                datagrd.DataSource = dt;
            }
            catch (Exception ex)
            {
                AgroFUN.SystemLog("CAT LOAD ERR" + ex.Message);
            }
        }
예제 #7
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (cmbTyp.Text == "Lot Matrix")
                {
                    frmItemAdd FRMUNIT = new frmItemAdd();
                    FRMUNIT.Show();
                }
                else
                {
                    if (PRODUCTID == 0)
                    {
                        string strQuery = string.Empty;
                        {
                            strQuery = "insert into product(ID,PRODUCTNAME,CATID,TYPE,UNITCOST,BARCODE,UNITPRICE,PACKQTY,SELLQTY,TAX1,TAX2,QTYONHAND,SUPPID,ISTOREID,CREATEDATE) values ('" + txtPId.Text + "','" + txtPName.Text + "','" + cmbCatId.Text + "','" + cmbTyp.Text + "','" + txtUnitCost.Text + "','" + txtBarcode.Text + "','" + txtUnitPrice.Text + "','" + txtPacketQty.Text + "','" + txtSellQty.Text + "','" + txtTax1.Text + "','" + txtTax2.Text + "','" + txtQtyOnHand.Text + "','" + cmbSupplId.Text + "','" + txtStoreId.Text + "','" + strDateTime + "')";

                            dLib.ExecuteNonQuery(AgroFUN.gblConnString, strQuery);
                            LoadGrid();
                        }
                    }
                }
                ClearValue();
            }

            catch (Exception ex)
            {
                AgroFUN.SystemLog("Save:" + ex.Message.ToString());
            }
        }
예제 #8
0
        private bool CheckValidation(string vType = "ADD")
        {
            bool ckhValid = true;

            try
            {
                string strCat = txtTenderName.Text.Trim();
                if (strCat.Length == 0)
                {
                    MessageBox.Show("Enter Firstname");
                    txtTenderName.Focus();
                    return(false);
                }


                if (vType == "ADD")
                {
                    if (dLib.CheckRecordExist(AgroFUN.gblConnString, "select ID from TENDERTYPE where lower(FNAME)='" + strCat.ToLower() + "'"))
                    {
                        MessageBox.Show("USER Name allredy Exist");
                        txtTenderName.Focus();
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                AgroFUN.SystemLog("CHEK CAT:" + ex.Message.ToString());
            }

            return(ckhValid);
        }
예제 #9
0
 private void cmbCatId_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         string txtCatId = cmbCatId.SelectedValue.ToString();
         CatId = Convert.ToInt32(txtCatId);
     }
     catch (Exception ex)
     {
         AgroFUN.SystemLog("CAT LOAD ERR" + ex.Message);
     }
 }
예제 #10
0
 private void LoadGrid()
 {
     try
     {
         string strLoad = string.Empty;
         strLoad = "SELECT * FROM PRODUCT WHERE ID='" + txtPId.Text + "'";
         DataTable dt = dLib.ExecuteDatTable(AgroFUN.gblConnString, strLoad);
         datagrditem.DataSource = dt;
     }
     catch (Exception ex)
     {
         AgroFUN.SystemLog("CAT LOAD ERR" + ex.Message);
     }
 }
예제 #11
0
 private void LoadPackGrid()
 {
     try
     {
         string strLoad = string.Empty;
         strLoad = "SELECT * FROM ITEMPACKDETAIL";
         DataTable dt = dLib.ExecuteDatTable(AgroFUN.gblConnString, strLoad);
         datagrdItemPack.DataSource = dt;
     }
     catch (Exception ex)
     {
         AgroFUN.SystemLog("CAT LOAD ERR" + ex.Message);
     }
 }
예제 #12
0
        private void LoadGrid()
        {
            try
            {
                string strLoad = string.Empty;
                strLoad = "SELECT P.ID,P.PRODUCTNAME,C.CATNAME,P.TYPE,P.UNITCOST,P.BARCODE,P.UNITPRICE,P.PACKQTY,P.SELLQTY,P.TAX1,P.TAX2,P.QTYONHAND,P.SUPPID,P.ISTOREID,P.CREATEDATE,P.UPDATEDATE FROM PRODUCT AS P LEFT JOIN CATEGORY AS C ON P.CATID = C.ID";


                DataTable dt = dLib.ExecuteDatTable(AgroFUN.gblConnString, strLoad);
                // datagrd.DataSource = dt;
            }
            catch (Exception ex)
            {
                AgroFUN.SystemLog("CAT LOAD ERR" + ex.Message);
            }
        }
예제 #13
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string strQuery = string.Empty;
                string strCat   = txtSettingName.Text.Trim();

                if (STORESETTINGNAME == "0")
                {
                    if (CheckValidation("ADD"))
                    {
                        strQuery = "INSERT INTO SETTING(SETTINGNAME,SETTINGVALUE) values ('" + strCat + "','" + txtSettingValue.Text + "')";
                        //STORESETTINGNAME = dLib.ReturnID(AgroFUN.gblConnString, strQuery, "ID");
                        dLib.ExecuteNonQuery(AgroFUN.gblConnString, strQuery);
                        STORESETTINGNAME = "0";
                    }
                }
                else
                {
                    if (CheckValidation("EDIT"))
                    {
                        if (txtSettingName.Text != strSTORESETTINGNAME)
                        {
                            if (!CheckValidation("ADD"))
                            {
                                return;
                            }
                        }
                        strQuery = "UPDATE SETTING set SETTINGVALUE='" + txtSettingValue.Text
                                   + "' where SETTINGNAME='" + STORESETTINGNAME + "'";
                        dLib.ExecuteNonQuery(AgroFUN.gblConnString, strQuery);
                        STORESETTINGNAME    = "0";
                        strSTORESETTINGNAME = "";
                    }
                }
                ClearValue();
                txtSettingName.ReadOnly = false;
                txtSettingName.Focus();
                txtSettingName.Text = "";
                LoadGrid();
            }
            catch (Exception ex)
            {
                AgroFUN.SystemLog("Save:" + ex.Message.ToString());
            }
        }
예제 #14
0
        private void btnAddItem_Click(object sender, EventArgs e)
        {
            try
            {
                string strQuery = string.Empty;
                {
                    //          strQuery = "insert into product(ID,ITEMID,BARCODE,PACK,PACKNAME,PACKPRICE,UNITCOST,PARENTID,SEQUENCES) values ('" + txtItemPackId.Text + "','" + txtItemId.Text + "','" +barcode +"','" + txtPackQty.Text + "','" + txtPackName.Text + "','" + txtPackPrice.Text + "','"+ UNITCOST"','" + PARENTID + "','" + SEQUENCES + "')";

                    dLib.ExecuteNonQuery(AgroFUN.gblConnString, strQuery);
                }
            }

            catch (Exception ex)
            {
                AgroFUN.SystemLog("Save:" + ex.Message.ToString());
            }
        }
예제 #15
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string strQuery = string.Empty;
                string strCat   = txtCode.Text.Trim();

                if (TAXCODE == "0")
                {
                    if (CheckValidation("ADD"))
                    {
                        strQuery = "INSERT INTO STORETAX(CODE,TAXTYPE,RATE) values ('" + strCat + "','" + txtType.Text + "','" + txtRate.Text + "')";
                        //TAXCODE = dLib.ReturnID(AgroFUN.gblConnString, strQuery, "ID");
                        dLib.ExecuteNonQuery(AgroFUN.gblConnString, strQuery);
                        TAXCODE = "0";
                    }
                }
                else
                {
                    if (CheckValidation("EDIT"))
                    {
                        if (txtCode.Text != strTaxCode)
                        {
                            if (!CheckValidation("ADD"))
                            {
                                return;
                            }
                        }
                        strQuery = "UPDATE STORETAX set RATE ='" + txtRate.Text + "',TAXTYPE='" + txtType.Text
                                   + "' where CODE='" + TAXCODE + "'";
                        dLib.ExecuteNonQuery(AgroFUN.gblConnString, strQuery);
                        TAXCODE    = "0";
                        strTaxCode = "";
                    }
                }
                ClearValue();
                txtCode.Focus();
                txtCode.Text = "";
                LoadGrid();
            }
            catch (Exception ex)
            {
                AgroFUN.SystemLog("Save:" + ex.Message.ToString());
            }
        }
예제 #16
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string strQuery = string.Empty;
                string strCat   = txtFName.Text.Trim();

                if (USERID == 0)
                {
                    if (CheckValidation("ADD"))
                    {
                        strQuery = "INSERT INTO USERS(FNAME,LNAME,LOGINNAME,PASSWORD,USERTYPE,CREATEDATE) values ('" + strCat + "','" + txtLName.Text.Replace("'", "") + "', '" + txtLoginName.Text + "','" + AgroFUN.EncodePassword(txtPassword.Text) + "','" + cmbUserType.Text + "','" + DateTime.Now.ToString("dd-MM-yyyy") + "')";
                        USERID   = dLib.ReturnID(AgroFUN.gblConnString, strQuery, "ID");
                        USERID   = 0;
                    }
                }
                else
                {
                    if (CheckValidation("EDIT"))
                    {
                        if (txtFName.Text != strUserName)
                        {
                            if (!CheckValidation("ADD"))
                            {
                                return;
                            }
                        }
                        strQuery = "UPDATE USERS set FNAME='" + strCat + "',LNAME='" + txtLName.Text.Replace("'", "") + "',LOGINNAME='" + txtLoginName.Text + "',Password ='******',UserType='" + cmbUserType.Text + "',UpdateDate='" + DateTime.Now.ToString("dd-MM-yyyy") + "' where ID=" + USERID;
                        dLib.ExecuteNonQuery(AgroFUN.gblConnString, strQuery);
                        USERID      = 0;
                        strUserName = "";
                    }
                }
                ClearValue();
                txtFName.Focus();
                txtFName.Text = "";
                LoadGrid();
            }
            catch (Exception ex)
            {
                AgroFUN.SystemLog("Save:" + ex.Message.ToString());
            }
        }
예제 #17
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string strQuery = string.Empty;
                string strCat   = txtTenderName.Text.Trim();

                if (TENDERID == 0)
                {
                    if (CheckValidation("ADD"))
                    {
                        strQuery = "INSERT INTO TENDERTYPE(TENDERNAME,TENDERSTATUS) values ('" + strCat + "','" + cmbTenderStatus.Text + "')";
                        TENDERID = dLib.ReturnID(AgroFUN.gblConnString, strQuery, "ID");
                        TENDERID = 0;
                    }
                }
                else
                {
                    if (CheckValidation("EDIT"))
                    {
                        if (txtTenderName.Text != strTenderName)
                        {
                            if (!CheckValidation("ADD"))
                            {
                                return;
                            }
                        }
                        strQuery = "UPDATE TENDERTYPE set TENDERNAME='" + strCat + "',TenderStatus='" + cmbTenderStatus.Text + "' where ID=" + TENDERID;
                        dLib.ExecuteNonQuery(AgroFUN.gblConnString, strQuery);
                        TENDERID      = 0;
                        strTenderName = "";
                    }
                }
                ClearValue();
                txtTenderName.Focus();
                txtTenderName.Text = "";
                LoadGrid();
            }
            catch (Exception ex)
            {
                AgroFUN.SystemLog("Save:" + ex.Message.ToString());
            }
        }
예제 #18
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string strQuery = string.Empty;
                string strCat   = txtFName.Text.Trim();

                if (CUSTOMERID == 0)
                {
                    if (CheckValidation("ADD"))
                    {
                        strQuery   = "INSERT INTO CUSTOMER(FNAME,LNAME,ADDRESS,CITY,State,Phone,Zip) values ('" + strCat + "','" + txtLName.Text.Replace("'", "") + "','" + txtAddress.Text.Replace("'", "") + "','" + txtCity.Text + "','" + txtState.Text + "','" + txtPhone.Text + "','" + txtZip.Text + "')";
                        CUSTOMERID = dLib.ReturnID(AgroFUN.gblConnString, strQuery, "ID");
                        CUSTOMERID = 0;
                    }
                }
                else
                {
                    if (CheckValidation("EDIT"))
                    {
                        if (txtFName.Text != strCustomerName)
                        {
                            if (!CheckValidation("ADD"))
                            {
                                return;
                            }
                        }
                        strQuery = "UPDATE CUSTOMER set FNAME='" + strCat + "',LNAME='" + txtLName.Text.Replace("'", "") + "',ADDRESS='" + txtAddress.Text.Replace("'", "") + "',CITY='" + txtCity.Text + "',State='" + txtState.Text + "',Phone='" + txtPhone.Text + "',Zip ='" + txtZip.Text + "' where ID=" + CUSTOMERID;
                        dLib.ExecuteNonQuery(AgroFUN.gblConnString, strQuery);
                        CUSTOMERID      = 0;
                        strCustomerName = "";
                    }
                }
                ClearValue();
                txtFName.Focus();
                txtFName.Text = "";
                LoadGrid();
            }
            catch (Exception ex)
            {
                AgroFUN.SystemLog("Save:" + ex.Message.ToString());
            }
        }
예제 #19
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                string strQuery = string.Empty;
                string strCat   = txtCategory.Text.Trim();

                if (CATID == 0)
                {
                    if (CheckValidation("ADD"))
                    {
                        strQuery = "INSERT INTO CATEGORY(CatName) values ('" + strCat + "')";
                        CATID    = dLib.ReturnID(AgroFUN.gblConnString, strQuery, "ID");
                        CATID    = 0;
                    }
                }
                else
                {
                    if (CheckValidation("EDIT"))
                    {
                        if (txtCategory.Text != strOldName)
                        {
                            if (!CheckValidation("ADD"))
                            {
                                return;
                            }
                        }
                        strQuery = "UPDATE CATEGORY set CatName='" + strCat + "' where ID=" + CATID;
                        dLib.ExecuteNonQuery(AgroFUN.gblConnString, strQuery);
                        CATID      = 0;
                        strOldName = "";
                    }
                }
                txtCategory.Focus();
                txtCategory.Text = "";
                LoadGrid();
            }
            catch (Exception ex)
            {
                AgroFUN.SystemLog("Save:" + ex.Message.ToString());
            }
        }
예제 #20
0
        public DataTable ExecuteDatTable(string Conn, string Squery)
        {
            DataTable dt = new DataTable();

            try
            {
                DataSet ds = new DataSet();
                ds = SqlHelper.ExecuteDataset(Conn, CommandType.Text, Squery);
                if (ds.Tables.Count > 0)
                {
                    dt = ds.Tables[0];
                }

                return(dt);
            }
            catch (Exception e)
            {
                AgroFUN.SystemLog("DataTable" + e.Message.ToString());
                return(dt);
            }
        }
예제 #21
0
        public int ReturnID(string Conn, string Squery, string vfield)
        {
            int iID = 0;

            try
            {
                DataSet       ds        = new DataSet();
                FbParameter[] objParams = new FbParameter[1];
                objParams[0]           = new FbParameter(vfield, SqlDbType.Int);
                objParams[0].Direction = ParameterDirection.Output;

                SqlHelper.ExecuteNonQuery(Conn, CommandType.Text, Squery, objParams);
                iID = (int)(objParams[0].Value);
                return(iID);
            }
            catch (Exception e)
            {
                AgroFUN.SystemLog("ReturnID" + e.Message.ToString());
                return(iID);
            }
        }
예제 #22
0
 private void LoadGrid()
 {
     try
     {
         string strLoad = string.Empty;
         string strCat  = txtSearch.Text.Trim();
         if (strCat.Length == 0)
         {
             strLoad = "SELECT SETTINGNAME,SETTINGVALUE FROM SETTING";
         }
         else
         {
             strLoad = "SELECT SETTINGNAME,SETTINGVALUE FROM SETTING where (LOWER(SETTINGNAME) LIKE '%" + strCat.ToLower() + "%') ";
         }
         DataTable dt = dLib.ExecuteDatTable(AgroFUN.gblConnString, strLoad);
         grdData.DataSource = dt.DefaultView;
     }
     catch (Exception ex)
     {
         AgroFUN.SystemLog("CAT LOAD ERR" + ex.Message);
     }
 }
예제 #23
0
 private void LoadGrid()
 {
     try
     {
         string strLoad = string.Empty;
         string strCat  = txtSearch.Text.Trim();
         if (strCat.Length == 0)
         {
             strLoad = "SELECT ID,FNAME,CITY,PHONE,STATE,ZIP,DEBITAMOUNT,CREDITAMOUNT FROM CUSTOMER";
         }
         else
         {
             strLoad = "SELECT ID,FNAME,CITY,PHONE,STATE,ZIP,DEBITAMOUNT,CREDITAMOUNT FROM CUSTOMER where (LOWER(FNAME) LIKE '%" + strCat.ToLower() + "%' or LOWER(LNAME) LIKE '%" + strCat.ToLower() + "%' ) ";
         }
         DataTable dt = dLib.ExecuteDatTable(AgroFUN.gblConnString, strLoad);
         grdData.DataSource = dt.DefaultView;
     }
     catch (Exception ex)
     {
         AgroFUN.SystemLog("CAT LOAD ERR" + ex.Message);
     }
 }
예제 #24
0
        private void grdUnit_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            for (int k = 0; k < grdData.SelectedRows.Count; k++)
            {
                USERID        = Convert.ToInt32(grdData.SelectedRows[k].Cells["ID"].Value);
                txtFName.Text = grdData.SelectedRows[k].Cells["FNAME"].Value.ToString();
                strUserName   = txtFName.Text;
                //Get The Value
                DataTable dt = dLib.ExecuteDatTable(AgroFUN.gblConnString, "select * from USERS where ID=" + USERID);
                if (dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];

                    txtLName.Text     = dr["LName"].ToString();
                    txtLoginName.Text = dr["LOGINNAME"].ToString();

                    txtPassword.Text = AgroFUN.DecodePassword(dr["Password"].ToString());
                    cmbUserType.Text = dr["UserType"].ToString();
                }

                txtFName.Focus();
            }
        }
예제 #25
0
        public void LOGDETAIL(string vAction)
        {
            string sqlInsert;

            try
            {
                if (AgroFUN.gblLogID == 0)
                {
                    sqlInsert = "INSERT INTO USERLOG(UserID,LogDate) values " +
                                "(" + AgroFUN.gblUserID + ",'" + DateTime.Now.ToString("MM-dd-yyyy") + "')" +
                                " returning ID";
                    // MessageBox.Show(sqlInsert);
                    AgroFUN.gblLogID = ReturnID(AgroFUN.gblConnString, sqlInsert, "ID");
                }
                sqlInsert = "INSERT INTO USERLOGDETAIL(LOGID,TASK,LOGDATETIME)" +
                            " values ('" + AgroFUN.gblLogID + "','" + vAction + "','" + DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss") + "')";
                ExecuteNonQuery(AgroFUN.gblConnString, sqlInsert);
                //Here Insert for local database recover opening balance
            }
            catch (Exception e)
            {
                AgroFUN.SystemLog("Log ERRorr" + e.Message.ToString());
            }
        }
예제 #26
0
        private void button2_Click(object sender, EventArgs e)
        {
            string strCat = string.Empty;

            strCat = txtSearch.Text;
            string datecheck = CheckDate(strCat).ToString();

            try
            {
                if (strCat.Length == 0)
                {
                    MessageBox.Show("Please enter Product Name OR Date to search");
                }
                else
                {
                    if (datecheck == "True")
                    {
                        string strLoad = string.Empty;
                        strLoad = "SELECT P.ID,P.PRODUCTNAME,C.CATNAME,P.TYPE,P.UNITCOST,P.BARCODE,P.UNITPRICE,P.PACKQTY,P.SELLQTY,P.TAX1,P.TAX2,P.QTYONHAND,P.SUPPID,P.ISTOREID,P.CREATEDATE,P.UPDATEDATE FROM PRODUCT AS P LEFT JOIN CATEGORY AS C ON P.CATID = C.ID WHERE P.CREATEDATE='" + txtSearch.Text + "' OR P.UPDATEDATE= '" + txtSearch.Text + "'";
                        DataTable dt = dLib.ExecuteDatTable(AgroFUN.gblConnString, strLoad);
                        datagrd.DataSource = dt.DefaultView;
                    }
                    else
                    {
                        string strLoad = string.Empty;
                        strLoad = "SELECT P.ID,P.PRODUCTNAME,C.CATNAME,P.TYPE,P.UNITCOST,P.BARCODE,P.UNITPRICE,P.PACKQTY,P.SELLQTY,P.TAX1,P.TAX2,P.QTYONHAND,P.SUPPID,P.ISTOREID,P.CREATEDATE,P.UPDATEDATE FROM PRODUCT AS P LEFT JOIN CATEGORY AS C ON P.CATID = C.ID WHERE P.PRODUCTNAME='" + strCat + "'";
                        DataTable dt = dLib.ExecuteDatTable(AgroFUN.gblConnString, strLoad);
                        datagrd.DataSource = dt.DefaultView;
                    }
                }
            }
            catch (Exception ex)
            {
                AgroFUN.SystemLog("CAT LOAD ERR" + ex.Message);
            }
        }
예제 #27
0
 public loginform()
 {
     InitializeComponent();
     //  this.WindowState = FormWindowState.Maximized;
     string str = AgroFUN.getConnectionString();
 }
예제 #28
0
 public frmMain()
 {
     InitializeComponent();
     lblDay.Text = DateTime.Now.ToString("dddd");
     string str = AgroFUN.getConnectionString();
 }
예제 #29
0
        private void loginbtn_Click(object sender, EventArgs e)
        {
            string uname = unametxt.Text;

            string password = passtxt.Text;

            if (string.IsNullOrEmpty(uname))
            {
                MessageBox.Show("Please enter UserName");
            }

            if (string.IsNullOrEmpty(password))
            {
                MessageBox.Show("Please enter Password");
            }



            else
            {
                DataTable dt = dLib.ExecuteDatTable(AgroFUN.gblConnString, "select * from USERS where LOGINNAME='" + uname + "' and PASSWORD='******'");

                if (dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];
                    MessageBox.Show("LogIn Successful");
                    frmMain fm = new frmMain();
                    fm.Show();
                    this.Hide();
                }

                else
                {
                    MessageBox.Show("invalid  login details");
                    cleardata();
                }
            }
        }