Пример #1
0
    protected void BtnDelete_Click(object sender, EventArgs e)
    {
        int i = Convert.ToInt32(hiddenbox.Value);

        if (i == 0)
        {
            try
            {
                int DeleteId = 0;
                if (ViewState["EditID"] != null)
                {
                    DeleteId = Convert.ToInt32(ViewState["EditID"]);
                }
                if (DeleteId != 0)
                {
                    Entity_Call.CompanyBankId = DeleteId;
                    Entity_Call.UserId        = Convert.ToInt32(Session["UserId"]);
                    Entity_Call.LoginDate     = DateTime.Now;
                    int iDelete = Obj_Call.DeleteRecord(ref Entity_Call, out StrError);
                    if (iDelete != 0)
                    {
                        Obj_Comm.ShowPopUpMsg("Record Deleted Successfully..!", this.Page);
                        MakeEmptyForm();
                    }
                }
                Entity_Call = null;
                Obj_Comm    = null;
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
    }
Пример #2
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        int InsertRow = 0, InsertRowDtls = 0;

        try
        {
            if (ChkDetails() == true)
            {
                Ds = Obj_Call.ChkDuplicate(ddlProject.SelectedValue, out StrError);
                if (Ds.Tables[0].Rows.Count > 0)
                {
                    Obj_Comm.ShowPopUpMsg("Record is Already Present..", this.Page);
                }
                else
                {
                    Entity_Call.PCId = Convert.ToInt32(ddlProject.SelectedValue);

                    Entity_Call.UserId    = Convert.ToInt32(Session["UserID"]);
                    Entity_Call.LoginDate = DateTime.Now;
                    InsertRow             = Obj_Call.InsertRecord(ref Entity_Call, out StrError);
                    if (InsertRow > 0)
                    {
                        if (ViewState["CurrentTable"] != null)
                        {
                            DataTable dtInsert = new DataTable();
                            dtInsert = (DataTable)ViewState["CurrentTable"];
                            for (int i = 0; i < dtInsert.Rows.Count; i++)
                            {
                                Entity_Call.CompanyBankId      = InsertRow;
                                Entity_Call.ProjectCompanyId   = Convert.ToInt32(dtInsert.Rows[i]["ProjectCompanyId"].ToString());
                                Entity_Call.BankTypeId         = Convert.ToInt32(dtInsert.Rows[i]["BankTypeId"].ToString());
                                Entity_Call.BankName           = dtInsert.Rows[i]["BankName"].ToString();
                                Entity_Call.Branch             = dtInsert.Rows[i]["Branch"].ToString();
                                Entity_Call.AccountNo          = dtInsert.Rows[i]["AccountNo"].ToString();
                                Entity_Call.RTGSNo             = dtInsert.Rows[i]["RTGSNo"].ToString();
                                Entity_Call.ChequeDrawnAccName = dtInsert.Rows[i]["ChequeDrawnAccName"].ToString();

                                InsertRowDtls = Obj_Call.InsertDetailsRecord(ref Entity_Call, out StrError);
                            }
                        }
                        if (InsertRow > 0)
                        {
                            Obj_Comm.ShowPopUpMsg("Record Saved Successfully", this.Page);
                            //MakeControlEmpty();
                            MakeEmptyForm();
                            Entity_Call = null;
                            Obj_Call    = null;
                        }
                    }
                }
            }


            else
            {
                Obj_Comm.ShowPopUpMsg("Please Enter Details ..!", this.Page);
            }
        }
        catch (Exception ex) { throw new Exception(ex.Message); }
    }
Пример #3
0
        public int InsertDetailsRecord(ref CompanyBankMaster Entity_Call, out string strError)
        {
            int iInsert = 0;

            strError = string.Empty;
            try
            {
                SqlParameter pAction             = new SqlParameter("@Action", SqlDbType.BigInt);
                SqlParameter pCompanyBankId      = new SqlParameter(CompanyBankMaster._CompanyBankId, SqlDbType.BigInt);
                SqlParameter pProjectCompanyId   = new SqlParameter(CompanyBankMaster._ProjectCompanyId, SqlDbType.BigInt);
                SqlParameter pBankTypeId         = new SqlParameter(CompanyBankMaster._BankTypeId, SqlDbType.BigInt);
                SqlParameter pBankName           = new SqlParameter(CompanyBankMaster._BankName, SqlDbType.NVarChar);
                SqlParameter pBranch             = new SqlParameter(CompanyBankMaster._Branch, SqlDbType.NVarChar);
                SqlParameter pAccountNo          = new SqlParameter(CompanyBankMaster._AccountNo, SqlDbType.NVarChar);
                SqlParameter pRTGSNo             = new SqlParameter(CompanyBankMaster._RTGSNo, SqlDbType.NVarChar);
                SqlParameter pChequeDrawnAccName = new SqlParameter(CompanyBankMaster._ChequeDrawnAccName, SqlDbType.NVarChar);

                pAction.Value             = 6;
                pCompanyBankId.Value      = Entity_Call.CompanyBankId;
                pProjectCompanyId.Value   = Entity_Call.ProjectCompanyId;
                pBankTypeId.Value         = Entity_Call.BankTypeId;
                pBankName.Value           = Entity_Call.BankName;
                pBranch.Value             = Entity_Call.Branch;
                pAccountNo.Value          = Entity_Call.AccountNo;
                pRTGSNo.Value             = Entity_Call.RTGSNo;
                pChequeDrawnAccName.Value = Entity_Call.ChequeDrawnAccName;

                SqlParameter[] Param = new SqlParameter[] { pAction, pCompanyBankId, pProjectCompanyId, pBankTypeId, pBankName, pBranch, pAccountNo, pRTGSNo, pChequeDrawnAccName };

                Open(CONNECTION_STRING);
                BeginTransaction();

                iInsert = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, CompanyBankMaster.SP_CompanyBankMaster, Param);

                if (iInsert > 0)
                {
                    CommitTransaction();
                }
                else
                {
                    RollBackTransaction();
                }
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                strError = ex.Message;
            }
            finally
            {
                Close();
            }
            return(iInsert);
        }
Пример #4
0
    protected void BtnUpdate_Click(object sender, EventArgs e)
    {
        int UpdateRow = 0, UpdateRowDtls = 0;

        try
        {
            if (ViewState["EditID"] != null)
            {
                Entity_Call.CompanyBankId = Convert.ToInt32(ViewState["EditID"]);
            }
            Entity_Call.PCId = Convert.ToInt32(ddlProject.SelectedValue);

            Entity_Call.UserId    = Convert.ToInt32(Session["UserId"]);
            Entity_Call.LoginDate = DateTime.Now;
            UpdateRow             = Obj_Call.UpdateRecord(ref Entity_Call, out StrError);
            if (UpdateRow > 0)
            {
                if (ViewState["CurrentTable"] != null)
                {
                    DataTable dtInsert = new DataTable();
                    dtInsert = (DataTable)ViewState["CurrentTable"];
                    for (int i = 0; i < dtInsert.Rows.Count; i++)
                    {
                        Entity_Call.CompanyBankId      = Convert.ToInt32(ViewState["EditID"]);;
                        Entity_Call.ProjectCompanyId   = Convert.ToInt32(dtInsert.Rows[i]["ProjectCompanyId"].ToString());
                        Entity_Call.BankTypeId         = Convert.ToInt32(dtInsert.Rows[i]["BankTypeId"].ToString());
                        Entity_Call.BankName           = dtInsert.Rows[i]["BankName"].ToString();
                        Entity_Call.Branch             = dtInsert.Rows[i]["Branch"].ToString();
                        Entity_Call.AccountNo          = dtInsert.Rows[i]["AccountNo"].ToString();
                        Entity_Call.RTGSNo             = dtInsert.Rows[i]["RTGSNo"].ToString();
                        Entity_Call.ChequeDrawnAccName = dtInsert.Rows[i]["ChequeDrawnAccName"].ToString();
                        UpdateRowDtls = Obj_Call.InsertDetailsRecord(ref Entity_Call, out StrError);
                    }
                }
                if (UpdateRow > 0)
                {
                    Obj_Comm.ShowPopUpMsg("Record Updated Successfully", this.Page);
                    MakeControlEmpty();
                    MakeEmptyForm();

                    Entity_Call = null;
                    Obj_Call    = null;
                }
            }
        }


        catch (Exception ex)
        {
            throw new Exception(ex.Message);
        }
    }
Пример #5
0
        public int UpdateRecord(ref CompanyBankMaster Entity_Call, out string strError)
        {
            int iInsert = 0;

            strError = string.Empty;
            try
            {
                SqlParameter pAction = new SqlParameter(CompanyBankMaster._Action, SqlDbType.BigInt);
                SqlParameter pPSId   = new SqlParameter(CompanyBankMaster._CompanyBankId, SqlDbType.BigInt);
                SqlParameter pPCId   = new SqlParameter(CompanyBankMaster._PCId, SqlDbType.BigInt);

                SqlParameter pCreatedBy   = new SqlParameter(CompanyBankMaster._UserId, SqlDbType.BigInt);
                SqlParameter pCreatedDate = new SqlParameter(CompanyBankMaster._LoginDate, SqlDbType.DateTime);


                pAction.Value = 2;
                pPSId.Value   = Entity_Call.CompanyBankId;
                pPCId.Value   = Entity_Call.PCId;

                pCreatedBy.Value   = Entity_Call.UserId;
                pCreatedDate.Value = Entity_Call.LoginDate;

                SqlParameter[] Param = new SqlParameter[] { pAction, pPSId, pPCId, pCreatedBy, pCreatedDate };

                Open(CONNECTION_STRING);
                BeginTransaction();

                iInsert = SQLHelper.ExecuteNonQuery(_Connection, _Transaction, CommandType.StoredProcedure, CompanyBankMaster.SP_CompanyBankMaster, Param);

                if (iInsert > 0)
                {
                    CommitTransaction();
                }
                else
                {
                    RollBackTransaction();
                }
            }
            catch (Exception ex)
            {
                RollBackTransaction();
                strError = ex.Message;
            }
            finally
            {
                Close();
            }
            return(iInsert);
        }