//Editing existing record
        public static bool UpdateLanguageType(ATTLookupLanguage objLT, Previlege pobj)
        {
            string        UpdateSQL = "SP_EDIT_LANGUAGE";
            GetConnection GetConn   = new GetConnection();

            try
            {
                OracleConnection DBConn = GetConn.GetDbConn(Module.LIS);

                if (Previlege.HasPrevilege(pobj, DBConn) == false)
                {
                    throw new ArgumentException(Utilities.PreviledgeMsg + " update Language.");
                }

                OracleParameter[] paramArray = new OracleParameter[2];
                paramArray[0] = Utilities.GetOraParam("p_LANG_ID", objLT.LookupLanguageID, OracleDbType.Int16, ParameterDirection.Input);
                paramArray[1] = Utilities.GetOraParam("p_LANG_ID", objLT.LookupLanguageName, OracleDbType.Varchar2, ParameterDirection.Input);
                SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, UpdateSQL, paramArray);
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                GetConn.CloseDbConn();
            }
        }
 public static bool SaveLanguage(ATTLookupLanguage obj, Previlege pobj)
 {
     try
     {
         return(PCS.LIS.DLL.DLLLookupLanguage.AddLanguage(obj, pobj));
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
    protected void LBLanguage_SelectedIndexChanged(object sender, EventArgs e)
    {
        List <ATTLookupLanguage> lst = (List <ATTLookupLanguage>)Session["LanguageTypeList"];
        ATTLookupLanguage LanguageType = lst.Find(delegate(ATTLookupLanguage LT)
        {
            return(LT.LookupLanguageID == int.Parse(this.LBLanguage.SelectedValue));
        }
                                                  );

        this.txtLookupName_Rqd.Text = LanguageType.LookupLanguageName;
        this.LblStatus.Text         = "";
    }
 public static bool UpdateLanguageType(ATTLookupLanguage objLT, Previlege pobj)
 {
     try
     {
         DLLLookupLanguage.UpdateLanguageType(objLT, pobj);
         return(true);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
    //Delete
    protected void BtnDelete_Click(object sender, EventArgs e)
    {
        ATTLookupLanguage ObjLT;

        if (LBLanguage.SelectedIndex > -1)
        {
            ObjLT = new ATTLookupLanguage(int.Parse(LBLanguage.SelectedValue));
            BLLLanguage.DeleteLanguage(ObjLT);
            LBLanguage.Items.Remove(LBLanguage.SelectedItem);
            txtLookupName_Rqd.Text = "";
            LblStatus.Text         = "Deleted..";
        }
    }
        public static List <ATTLookupLanguage> GetLanguageList()
        {
            List <ATTLookupLanguage> LanguageTypeLST = new List <ATTLookupLanguage>();

            foreach (DataRow row in DLLLookupLanguage.GetLanguage().Rows)
            {
                ATTLookupLanguage LL = new ATTLookupLanguage(int.Parse(row["LANG_ID"].ToString()),
                                                             row["LANG_NAME"].ToString()
                                                             );
                LanguageTypeLST.Add(LL);
            }
            return(LanguageTypeLST);
        }
        public static bool DeleteLanguage(ATTLookupLanguage objLT)
        {
            try
            {
                //if (Previlege.HasPrevilege(username, Previlege.PrevilegeType.P_DELETE, menuname) == false)
                //    throw new ArgumentException(Utilities.PreviledgeMsg + " delete Language.");

                DLLLookupLanguage.DeleteLanguage(objLT);
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        //Deleting record
        public static bool DeleteLanguage(ATTLookupLanguage objLT)
        {
            string        DeleteSQL = "SP_DEL_LANGUAGE";
            GetConnection GetConn   = new GetConnection();

            try
            {
                OracleConnection  DBConn     = GetConn.GetDbConn(Module.LIS);
                OracleParameter[] paramArray = new OracleParameter[1];
                paramArray[0] = Utilities.GetOraParam("p_LANG_ID", objLT.LookupLanguageID, OracleDbType.Int16, ParameterDirection.Input);
                SqlHelper.ExecuteNonQuery(DBConn, CommandType.StoredProcedure, DeleteSQL, paramArray);
                return(true);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                GetConn.CloseDbConn();
            }
        }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        ATTLookupLanguage ObjLT;

        if (LBLanguage.SelectedIndex == -1)
        {
            ObjLT = new ATTLookupLanguage(0, txtLookupName_Rqd.Text, "User_Ashok", DateTime.Now.ToString());
        }
        else
        {
            ObjLT = new ATTLookupLanguage(int.Parse(this.LBLanguage.SelectedValue), txtLookupName_Rqd.Text, "User_Ashok", DateTime.Now.ToString());
        }
        List <ATTLookupLanguage> ltLanguage = (List <ATTLookupLanguage>)Session["LanguageTypeList"];
        ATTUserLogin             user       = ((ATTUserLogin)Session["Login_User_Detail"]);

        try
        {
            if (LBLanguage.SelectedIndex == -1)
            {
                if (user.MenuList["4,7,1"] == null || user.MenuList["4,7,1"].PAdd == "N")
                {
                    this.LblStatus.Text = Utilities.PreviledgeMsg + " add Language.";
                    return;
                }

                Previlege pobj = new Previlege(user.UserName, "4,7,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_ADD);

                if (BLLLanguage.SaveLanguage(ObjLT, pobj))
                {
                    ltLanguage.Add(ObjLT);
                    LblStatus.Text         = "Language Inserted as: " + txtLookupName_Rqd.Text + ".";
                    txtLookupName_Rqd.Text = "";
                    txtLookupName_Rqd.Focus();
                }
            }
            else
            {
                if (user.MenuList["4,7,1"] == null || user.MenuList["4,7,1"].PEdit == "N")
                {
                    this.LblStatus.Text = Utilities.PreviledgeMsg + " update Language.";
                    return;
                }

                Previlege pobj = new Previlege(user.UserName, "4,7,1", int.Parse(((HiddenField)this.Master.FindControl("hdnApplicationID")).Value), Previlege.PrevilegeType.P_EDIT);

                if (BLLLanguage.UpdateLanguageType(ObjLT, pobj))
                {
                    ltLanguage[this.LBLanguage.SelectedIndex] = ObjLT;
                    LblStatus.Text = "Record updated...";
                }
            }
            LBLanguage.DataSource     = ltLanguage;
            LBLanguage.DataTextField  = "LookupLanguageName";
            LBLanguage.DataValueField = "LookupLanguageID";
            LBLanguage.DataBind();
        }
        catch (Exception ex)
        {
            this.LblStatus.Text = ex.Message;
        }
    }